For the past week I have been working on trying to get Selenium to function at all on a laptop that I freshly installed Ubuntu onto solely to work on personal projects. I was not finding any good solutions from Google search, most of the results were from 5+ years ago and even the newer examples did not function.
I have done basic troubleshooting. On top of that I went through the source code and had it pause and print out information to make sure they were correct. None of this has helped, not even getting the selenium manager executable, the top one from here and putting it into the spot that the selenium_manager.py script expects it to be.
I had a few different versions of testing files, put below:
from selenium import webdriverbrowser = webdriver.Firefox()
from selenium import webdriveropt = webdriver.FirefoxOptions()drv = webdriver.firefox.service.Service()drv.path = "/snap/bin/firefox"opt.binary_location = '/snap/bin/firefox.geckodriver'browser = webdriver.Firefox(options=opt, service=drv)browser.get("http://www.example.com")
The error messages I encountered when testing these and editing the source code were:
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for firefox using Selenium Manager. selenium.common.exceptions.WebDriverException: Message: Unable to obtain working Selenium Manager binary; /usr/lib/python3/dist-packages/selenium/webdriver/common/linux/selenium-managerselenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executableselenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /snap/bin/geckodriver/snap/bin/geckodriver selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /snap/bin/firefox/snap/bin/firefox