Error using Selenium Webdriver in Python

Asked

Viewed 2,493 times

2

I’m trying to develop a script in Python that simply open the browser as shown on that site Selenium with Chrome, but every time I try to run the program I come across the following error:

browser = webdriver. Chrome() Attributeerror: module 'Selenium.webdriver' has no attribute 'Chrome'

Below is the complete code:

from selenium import webdriver driver = webdriver.Chrome('C:\Program
Files (x86)\Google\Chrome\Application\chrome.exe')

IDE: Pycharm.

NOTE: I already downloaded the Chromedriver and reinstalled the Selenium several times.

2 answers

1

Follow the code I use:

from selenium import webdriver
self.driver = webdriver.Chrome('C:\\chromedriver.exe')
self.driver.get("http://www.google.com")

Use two bars in the path.

  • 1

    Thanks for the help, that was not the problem and yes it was missing to add the module of Selenium in the settings of Pycharm, must be a beginner error in Python kkkk, but thanks

1

I used exactly this code from link you sent. I’m using the visual studio with version 3.6 of Python. In this simply isntalar Selenium via Pip and download the Chrome driver. Extract the exe and put it in a folder of choice. I put it in a paw called "C: Bin". The resulting code is identical to yours but with the difference that you should point to the Chrome driver and not to the Chrome exe.

driver = webdriver.Chrome('C:\Bin\chromedriver.exe') 

You can find the driver to download here: on the google page for this purpose.

  • Thanks for the help but already tried this and results in the same error <<driver = webdriver. Chrome('C: chromedriver_win32 chromedriver.exe')>> Is this a Pycharm problem? , or did you add Chromedriver to the PATH? Attributeerror: module 'Selenium.webdriver' has no attribute 'Chrome'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.