1

I installed selenium/standalone-chrome in docker, and the version is 4.1.2. But when I run my python code get bellow error:

enter image description here

My selenium/standalone-chrome in docker:

enter image description here

My python code:

def demo():
    options = Options()
    options.add_argument('--headless')
    options.add_argument('--disable-gpu')
    driver = webdriver.Remote(
        command_executor="http://localhost:4444/wd/hub",
        desired_capabilities=DesiredCapabilities.CHROME
    )
    driver.get("https://www.google.com/")
    print(driver.current_url)
    driver.quit()

Could anyone give me a favor on this issue? Thanks.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
yanny
  • 11
  • 1
  • 2

2 Answers2

0

You can fix your code by only adding this line to your code

options.set_capability("browserVersion", "98")
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
-3

This error message...

selenium.common.exceptions.SessionNotCreatedException: Message:  Could not start a new session. ... Response code 500.
.
Driver info: driver.version: unknown

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chrome=98.0
  • Release Notes of ChromeDriver v98.0 clearly mentions the following :

Supports Chrome version 98

  • But your chromedriver version is not getting detected.

Driver info: driver.version: unknown

So most possibly there is a mismatch between chromedriver version and the chrome=98.0


Solution

Ensure that:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352