Quantcast
Channel: Selenium using Python - Geckodriver executable needs to be in PATH - Stack Overflow
Viewing all articles
Browse latest Browse all 38

Answer by Snidhi Sofpro for Selenium using Python - Geckodriver executable needs to be in PATH

$
0
0

Some additional input/clarification:

The following suffices as a resolution for Windows 7, Python 3.6, and Selenium 3.11:

dsalaj's note for another answer for Unix is applicable to Windows as well; tinkering with the PATH environment variable at the Windows level and restart of the Windows system can be avoided.

(1) Download geckodriver (as described in this thread earlier) and place the (unzipped) geckdriver.exe at X:\Folder\of\your\choice

(2) Python code sample:

import os;os.environ["PATH"] += os.pathsep + r'X:\Folder\of\your\choice';from selenium import webdriver;browser = webdriver.Firefox();browser.get('http://localhost:8000')assert 'Django' in browser.title

Notes:

(1) It may take about 10 seconds for the above code to open up the Firefox browser for the specified URL.

(2) The Python console would show the following error if there's no server already running at the specified URL or serving a page with the title containing the string 'Django':

selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=connectionFailure&u=http%3A//localhost%3A8000/&c=UTF-8&f=regular&d=Firefox%20can%E2%80%9


Viewing all articles
Browse latest Browse all 38

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>