cannot find chrome driver in python script

瀏覽次數:1,837 次
跳到第一則未讀訊息

Sapana Devani

未讀,
2018年5月10日 凌晨3:31:132018/5/10
收件者: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

未讀,
2018年5月10日 清晨5:07:472018/5/10
收件者: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

未讀,
2018年5月10日 清晨5:15:322018/5/10
收件者: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

未讀,
2018年5月10日 上午10:30:302018/5/10
收件者: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

未讀,
2018年5月10日 上午11:46:092018/5/10
收件者: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

未讀,
2018年5月10日 下午1:47:462018/5/10
收件者: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

未讀,
2018年5月11日 凌晨2:20:032018/5/11
收件者: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

未讀,
2018年5月11日 凌晨2:49:552018/5/11
收件者: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

未讀,
2018年5月11日 凌晨2:54:112018/5/11
收件者: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

未讀,
2018年5月11日 凌晨3:04:522018/5/11
收件者: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

未讀,
2018年5月11日 清晨6:42:482018/5/11
收件者: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.
回覆所有人
回覆作者
轉寄
0 則新訊息