python3.6.1+selenium3.0 environment installation problem and solution

Source: Internet
Author: User

Script: (open Firefox browser, go to Baidu Web page, search selenium)

 from Import  = webdriver. Firefox (); Browser.get ("http://www.baidu.com"); browser.find_element_by_id (  "kw"). Send_keys ("selenium"); browser.find_element_by_id ("su"). Click (); Browser.quit ();

Executive PIN This report error 1:

Traceback (most recent): File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\common\service.py", line 74,inchStart stdout=self.log_file, stderr=self.log_file) File"D:\2017\programming language\python\installpath\lib\subprocess.py", line 707,inch __init__Restore_signals, Start_new_session) File"D:\2017\programming language\python\installpath\lib\subprocess.py", Line 990,inch_execute_child Startupinfo) Filenotfounderror: [Winerror2] The system could not find the file specified. During handling of the above exception, another exception Occurred:traceback (most recent call last): File"D:\2017\programming language\python\installpath\scripts\baidu.py", Line 3,inch<module>Browser=Webdriver.  Firefox (); File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\firefox\webdriver.py ", line 142,inch __init__Self.service.start () File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\common\service.py", line 81,inchstart Os.path.basename (self.path), self.start_error_message) Selenium.common.exceptions.WebDriverException: Message:  'geckodriver' executable needs to is  in PATH. 
mentioned here Geckodriver Drive, selenium3.x, Firefox browser driver Independent, need to install separately;
Workaround: Download the Geckodriver driver and place it in the Python installation path, making sure that the path is added to path;

Execute the script again, error 2:
Traceback (most recent): File"D:\2017\programming language\python\installpath\scripts\baidu.py", Line 3,inch<module>Browser=Webdriver.  Firefox (); File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\firefox\webdriver.py ", Line 152,inch __init__keep_alive=True) File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\remote\webdriver.py ", line 98,inch __init__self.start_session (desired_capabilities, browser_profile) File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\remote\webdriver.py ", line 188,inchstart_session Response=Self.execute (command.new_session, parameters) File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\remote\webdriver.py ", line 256,inchExecute Self.error_handler.check_response (response) File"D:\2017\programming language\python\installpath\lib\site-packages\selenium\webdriver\remote\errorhandler.py ", line 194,inchCheck_responseRaiseexception_class (message, screen, StackTrace) Selenium.common.exceptions.WebDriverException:Message: Unable To find a matching set of capabilities 

Workaround:

1. Check native Java version, selenium3.x only support java8 version above, here meet the requirements;

2. Geckodriver version is v0.16.1, Firefox browser version is 45, uninstall Firefox, install the latest version of Firefox version 53;

Run the script to execute normally.

python3.6.1+selenium3.0 environment installation problem and solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.