Forums

Selenium Session Not Created Excpetion

I just started working with selenium again after a break and the code that used to work, does not anymore.

Here is the code:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
browser.get("https://www.google.com")
print("Page title was '{}'".format(browser.title))
finally:
browser.quit()

The error is:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Missing or invalid capabilities (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.13.0-1022-aws x86_64)

I tried uninstalling the selenium package, reinstalling and using the upgrade option but no change. Like I said, it was working but I am not sure what I may have done.

I'm assuming it is related to:

https://www.pythonanywhere.com/forums/topic/27342/

Check that you're using the right version of selenium: https://help.pythonanywhere.com/pages/selenium/

the same problrm ?

@mzr2yi What problem?