Reputation: 1258
I am trying to connect to my firefox browser with selenium.
#Initialise Firefox
print("here")
locationofDriver = "C:/Users/barry/OneDrive/Documents/Webdriver/"
print("here2")
driver = webdriver.Firefox(locationofDriver)
print("here3")
Yet I get two errors:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
And:
urllib3.exceptions.ProtocolError: ('Connection aborted.', TimeoutError(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond', None, 10060, None))
The Output from the print statements:
here
here2
I launched Firefox manually to see if their was an issue, however it is perfectly functional The web-driver is in the correct place.
Any help appreciated.
Upvotes: 1
Views: 6794
Reputation: 2804
try it:
locationofDriver = "<path to file>/geckodriver.exe"
Or add geckodriver.exe
to directory with working python file and then you can try:
driver = webdriver.Firefox()
Upvotes: 0
Reputation: 193058
Instead providing only the location of the WebDriver executable you need to provide the absolute path of the ChromeDriver / GeckoDriver along with the extension i.e. .exe
. So your effective code block will be:
For ChromeDriver:
locationofDriver = r'C:/Users/barry/OneDrive/Documents/Webdriver/chromedriver.exe'
For GeckoDriver:
locationofDriver = r'C:/Users/barry/OneDrive/Documents/Webdriver/geckodriver.exe'
Finally, you can pass the key executable_path
along the value as follows:
driver = webdriver.Firefox(executable_path=locationofDriver)
Upvotes: 1