Python+selenium Remote startup Firefox error summary

Source: Internet
Author: User

#Coding=utf-8 fromSelenium.webdriverImportRemotedr= Remote (command_executor='Http://127.0.0.1:4444/wd/hub', Desired_capabilities={'Platform':' any',                                'Browsername':'Firefox',                                'version':"',                                'javascriptenabled': True}) Dr.get ("https://www.baidu.com") dr.find_element_by_id ("kw"). Send_keys ("Grid") dr.find_element_by_id ("su"). Click ()Print("OK") Dr.quit ()

This piece of code has been an error, do not know the reason, the online review of various methods after verification can not, change to change, and finally I do not know that way to change the good, can only put all the problems recorded. The error was not at the time, can only recall the approximate error message:

1, the first troubleshooting, found that the browser installation path is not placed in the environment variables, corrected, error

2, There are users of the solution Is: open ie-set-internet Options-lan LAN Settings-proxy server. This item is not Checked. My IE is not checked at this Location. So this workaround doesn't work

3. Error hint: The path to the driver executable must is set by the Webdriver.gecko.driver system property; For more information, See https://github.com/mozilla/ge ... The latest version can be downloaded fromhttps://github.com/mozilla/ge ...

After download, put Geckodriver decompression in the installation directory, add the PATH environment variable and run still error

4 Error [10061]. Forgot to run selenium server.

5, The runtime browser is repeated to open multiple errors,

The workaround is: add ' marionette ' to the Code: False to run successfully.

The above is the problem I encountered, the specific error message is not clear, probably remember, but also to do a Lesson.

After encountering an error, direct, solve the problem after the Filing.

Depressed is: the problem solved, but I do not know in the end is that way to Solve.

Summarize:

Python+selenium using remote to launch the Browser:

1. Start Selenium Server first

2. Change the code as follows

#Coding=utf-8 fromSelenium.webdriverImportRemotedr= Remote (command_executor='Http://127.0.0.1:4444/wd/hub', Desired_capabilities={'Platform':' any',                                'Browsername':'Firefox',                                'version':"',                                'javascriptenabled': True,'Marionette': False}) Dr.get ("https://www.baidu.com") dr.find_element_by_id ("kw"). Send_keys ("Grid") dr.find_element_by_id ("su"). Click ()Print("OK") Dr.quit ()

' Marionette ': False Marionette is a Python client that allows a gecko-based browser or device running remote control to run a marionette server, including desktop Firefox and Firefox os. This parameter is Firefox special.

The above about marionette interpretation, refer to the Book of automated tests by the Zerg selenium2, in p242

Python+selenium Remote startup Firefox error summary

Related Article

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.