Python Selenium module uses error-selenium.common.exceptions.webdriverexception:message: ' Geckodriver ' executable needs to IS in PATH.

Source: Internet
Author: User
Tags seleniumhq

Python 2.7+selenium+firefox 55.0.3

Code:

 fromSeleniumImportWebdriver fromSelenium.common.exceptionsImportnosuchelementexception fromSelenium.webdriver.common.keysImportKeysImportTimebrowser= Webdriver. Firefox ()#Get Local session of FirefoxBrowser.get ("http://www.yahoo.com")#Load Pageassert "Yahoo !" inchBrowser.titleelem= Browser.find_element_by_name ("P")#Find the Query boxElem.send_keys ("SELENIUMHQ"+Keys.return) Time.sleep (0.2)#Let the page load, would be is added to the APITry: Browser.find_element_by_xpath ("//a[contains (@href, ' http://seleniumhq.org ')]")exceptnosuchelementexception:assert0,"can ' t find SELENIUMHQ"browser.close ()

The error message is as follows:

Selenium.common.exceptions.WebDriverException:Message: ' geckodriver ' executable needs to is in PATH.

Answer Picks: https://www.zhihu.com/question/49568096

1. Selenium 3.x, webdriver/firefox/webdriver.py __init__, executable_path= "Geckodriver"; 2.x is executable_path= " Wires
2. Firefox 47 or above, need to download third party driver, namely Geckodriver;http/docs.seleniumhq.org/download/ Third party Drivers, Bindings, and plugins below to find Mozilla Geckodriver, download to any computer any directory (Mac down to/usr/bin/and/sbin/,/bin/,/usr/ local/bin/), add the path to the PC's path (for Windows) after decompression.

Iceblue Iceblue
Links: https://www.zhihu.com/question/49568096/answer/119324584
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

Python Selenium module uses error-selenium.common.exceptions.webdriverexception:message: ' Geckodriver ' executable needs to IS in PATH.

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.