I am trying to use selenium in python to create a webcrawler. The code works just fine on one of my computers, but on the other one, I'm getting an error from the last line of code:
from snownlp import SnowNLP
from pyquery import PyQuery as pq
from selenium import webdriver
from datetime import datetime, tzinfo
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
browser = webdriver.Firefox(options=options, executable_path = r'path\to\geckodriver.exe')
And this is the error I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "E:\VNConda\Lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 174, in __init__
keep_alive=True)
File "E:\VNConda\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "E:\VNConda\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "E:\VNConda\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "E:\VNConda\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
Versions: Python 3.7.0 Selenium 3.141.0 Firefox 67.0.4 GeckoDriver 0.24.0 Windows 10
Both computers have the same versions and setup, so I'm not sure what is wrong. It works on the other computer even without the executable_path
variable specified, and geckodriver is in the same relative location on both computers.
I've made sure everything is updated and tried setting marionette to false as suggested here.
Since it works just as is on one computer, I feel that it could be some setup issue in the other, but am not sure where to look.