cannot find chrome driver in python script

1.829 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Sapana Devani

chưa đọc,
03:31:13 10 thg 5, 201810/5/18
đến 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

chưa đọc,
05:07:47 10 thg 5, 201810/5/18
đến 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

chưa đọc,
05:15:32 10 thg 5, 201810/5/18
đến 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

chưa đọc,
10:30:30 10 thg 5, 201810/5/18
đến 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

chưa đọc,
11:46:09 10 thg 5, 201810/5/18
đến 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

chưa đọc,
13:47:46 10 thg 5, 201810/5/18
đến 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

chưa đọc,
02:20:03 11 thg 5, 201811/5/18
đến 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

chưa đọc,
02:49:55 11 thg 5, 201811/5/18
đến 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

chưa đọc,
02:54:11 11 thg 5, 201811/5/18
đến 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

chưa đọc,
03:04:52 11 thg 5, 201811/5/18
đến 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

chưa đọc,
06:42:48 11 thg 5, 201811/5/18
đến 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.
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới