cannot find chrome driver in python script

1,811 views
Skip to first unread message

Sapana Devani

unread,
May 10, 2018, 3:31:13 AM5/10/18
to seleniu...@googlegroups.com
Hi All,

 I have written my first python script using selenium. I am using pycharm.

I got an error of chrome driver even I have downloaded chrome driver & set path in my script.


below are my script,

from selenium import webdriver


driver = webdriver.Chrome ("C:\chromedriver\chromedriver.exe")
driver.set_page_load_timeout(30)
driver.get("http://www.facebook.com")
driver.maximazie_window()
driver.implicitly_wait(20)
driver.get_screenshot_as_file("Facebook.png")
driver.quit()
I got an error like this

C:\Users\SapanaD\PycharmProjects\seleniumscripts\venv\Scripts\python.exe C:/Users/SapanaD/PycharmProjects/seleniumscripts/facebookpackage/Myfirstscript.py
Traceback (most recent call last):
  File "C:/Users/SapanaD/PycharmProjects/seleniumscripts/facebookpackage/Myfirstscript.py", line 4, in <module>
    driver = webdriver.Chrome ("C:\chromedriver\chromedriver.exe")
AttributeError: 'module' object has no attribute 'Chrome'

Process finished with exit code 1

Please help me

Thanks in advance.

Sapana

arshan khan

unread,
May 10, 2018, 5:07:47 AM5/10/18
to seleniu...@googlegroups.com
System.setProperty("webdriver.chrome.driver", " C:\\chromedriver\\chromedriver.exe ");
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
 WebDriver driver = new ChromeDriver(options);

u can try this.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAL4jT3tyCWJCS_COjy4qZa_6xiPou0aMkf6nrYBfTFtL3pJUPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Sapana Devani

unread,
May 10, 2018, 5:15:32 AM5/10/18
to seleniu...@googlegroups.com
Hi


I am using python not java

To post to this group, send email to seleniu...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

Deebesh S

unread,
May 10, 2018, 10:30:30 AM5/10/18
to seleniu...@googlegroups.com
go to the chrome folder and press shiftkey and then right click and select the option select as path

and run

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

Wayne

unread,
May 10, 2018, 11:46:09 AM5/10/18
to seleniu...@googlegroups.com
try place chromedriver.exe in the same folder as your python program.

On Thu, May 10, 2018 at 3:30 AM, Sapana Devani <devanis...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

Doug Dragon

unread,
May 10, 2018, 1:47:46 PM5/10/18
to Selenium Users
It looks like there's a space in your command.

This is from the chromedriver docs for Python:

driver = webdriver.Chrome('/path/to/chromedriver')  # Optional argument, if not specified will search path.

I believe you need to escape the slashes on a Windows system.

Hope this helps,

-Doug

Sapana Devani

unread,
May 11, 2018, 2:20:03 AM5/11/18
to seleniu...@googlegroups.com
Hi,

I have tried above all the solutions but didn't work.


Thanks,
Sapana

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

Punkaaj Chavaan

unread,
May 11, 2018, 2:49:55 AM5/11/18
to Selenium Users
Hi,

1) Update chrome driver to the latest version - 2.38
2) Keep chromedriver.exe folder path at the start of the PATH variable.
3) Use below code and let me know the result.

Here's working version code:
from selenium import webdriver

driver = webdriver.Chrome("C:\\bin\\chromedriver.exe")

driver.set_page_load_timeout(30)
driver.get("http://www.facebook.com")
driver.maximize_window()

driver.implicitly_wait(20)
driver.get_screenshot_as_file("Facebook.png")
driver.quit()


Regards,
Punkaaj
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Sapana Devani

unread,
May 11, 2018, 2:54:11 AM5/11/18
to seleniu...@googlegroups.com
the same code is working on eclipse but didn't work in pycharm





To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/101321a7-01db-4917-9069-316b3424014c%40googlegroups.com.

Punkaaj Chavaan

unread,
May 11, 2018, 3:04:52 AM5/11/18
to seleniu...@googlegroups.com
I'm using pycharm only and it run successfully...

Check pycharm preferences for python version and valid installation...
You may have multiple versions of python installed.


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/Df-iAERCOJo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.

Sapana Devani

unread,
May 11, 2018, 6:42:48 AM5/11/18
to seleniu...@googlegroups.com
@punkaaj

I use python 3.4 which version have you used?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages