A
A
Alexey R2018-12-08 22:44:25
Python
Alexey R, 2018-12-08 22:44:25

Why won't Firefox 52 ESR run under geckodriver?

Good day dear community. Please guide me in the right direction. Please tell me why I can't start Firefox with selenium webdriver. Selenium installed with pip. I took the drivers for Chrome and Firefox from the official pages on GitHub. When writing simple code

from selenium import webdriver
browser=webdriver.Chrome("C:\\chromedriver.exe")

everything is working. Chrome opens up nicely. But Firefox is exactly what I need (it's not a matter of principle at all). And when writing code with little changes
from selenium import webdriver
browser=webdriver.Firefox("C:\\geckodriver.exe")

I get an error
Traceback (most recent call last):
File "C:\Users\PC1\Desktop\SeleniumWebDR.py", line 3, in
browser=webdriver.Firefox("C:\\geckodriver.exe")
File "C:\Users \PC1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 151, in __init__
firefox_profile = FirefoxProfile(firefox_profile)
File "C:\Users\ PC1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 80, in __init__
ignore=shutil.ignore_patterns("parent.lock", "lock ", ".parentlock"))
File "C:\Users\PC1\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 309,in copytree
names = os.listdir(src)
NotADirectoryError: [WinError 267] Invalid folder name: 'C:\\geckodriver.exe'

I tried not to specify the address of the driver, but to add the environment variables path to (PATH) and if I put the driver in the folder with the script I have the following error
Traceback (most recent call last):
File "C:\Users\PC1\Desktop\SeleniumWebDR.py", line 3, in
browser=webdriver.Firefox()
File "C:\Users\PC1\AppData\Local\Programs\ Python\Python37-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 174, in __init__
keep_alive=True)
File "C:\Users\PC1\AppData\Local\Programs\Python\Python37 -32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\PC1\AppData\Local\Programs\Python\ Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\PC1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response )
File "C:\Users\PC1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen , stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

This code is described in the documentation, but if you write like this
from selenium import webdriver
browser = webdriver.Firefox(capabilities={"marionette": False})

then everything works. Help me please. Explain why so!
Python version
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on
win32

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
ScriptKiddo, 2018-12-09
@ScriptKiddo

Try the version from this link
Put it in the folder that you added to PATH
Use the following code to test:

from selenium import webdriver
driver = webdriver.Firefox()

A
Alexey R, 2018-12-09
@Axeles

Oddly enough, after reinstalling Firefox, everything worked. Many thanks to everyone for the tips! Happy holidays to you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question