Unrecognized Chrome version when using Selenium (python bindings) and chromedriver



  • Hi!

    I'm trying to use QtWebEngine for automation using python scripts and Selenuim library.
    I use "minimal" example https://doc.qt.io/qt-5.11/qtwebengine-webenginewidgets-minimal-example.html for this.

    But I ran into the next problem. After launching the script, the application starts normally, but after a few seconds it crashes with the following error:

    Traceback (most recent call last):
      File "C:/Users/Yura/Desktop/VKS/group_analysis/test_selenium.py", line 10, in <module>
        driver = webdriver.Remote("http://127.0.0.1:9515", desired_capabilities=options.to_capabilities())
      File "C:\Users\Yura\Desktop\VKS\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__
        self.start_session(capabilities, browser_profile)
      File "C:\Users\Yura\Desktop\VKS\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
      File "C:\Users\Yura\Desktop\VKS\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
        self.error_handler.check_response(response)
      File "C:\Users\Yura\Desktop\VKS\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.WebDriverException: Message: unknown error: unrecognized Chrome version: minimal/
      (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)
    

    Here is the script that I use:

    from time import sleep
    from selenium import webdriver
    
    options = webdriver.ChromeOptions()
    options.binary_location = r"C:\Qt\Examples\Qt-5.12.0\webenginewidgets\build-minimal-Desktop_Qt_5_12_0_MSVC2017_64bit-Debug\debug\minimal.exe"
    options.add_argument("--remote-debugging-port=9222")
    options.add_argument("--headless")
    options.add_argument("--disable-gpu")
    
    driver = webdriver.Remote("http://127.0.0.1:9515", desired_capabilities=options.to_capabilities())
    
    print("initialized")
    
    driver.get("https://google.com")
    
    print("loaded")
    
    sleep(5)
    driver.close()
    

    Script hangs when "driver = webdriver.Remote" line is executed and then falls.
    Chromedriver cyclically issues a lot of such messages to the console:

    [1541092558.416][DEBUG]: DevTools HTTP Request: http://localhost:9222/json/version
    [1541092558.417][DEBUG]: DevTools HTTP Response: {
       "Browser": "minimal/",
       "Protocol-Version": "1.3",
       "User-Agent": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.0 Chrome/69.0.3497.113 Safari/537.36",
       "V8-Version": "6.9.427.29",
       "WebKit-Version": "537.36 (@813bf9b1a5703461864fe56d23b6224480581ae1)",
       "webSocketDebuggerUrl": "ws://localhost:9222/devtools/browser/7048ad82-557b-4dc8-98c7-55cd0c173e22"
    }
    

    Also tried to run the script without flags --headless and --disable-gpu. The result is same.
    The following toolset was used: Window 10 x64 (also tried Ubuntu 18.04), Qt 5.12 beta3 msvc2017 64 bit (also tried 5.11.2, 5.9.1), python 3.6, selenuim 3.14.1, chromedriver 2.43.

    What could be the problem?
    Thanks!



  • I had the same problem, and a way to hack it is to set your QT applicationName and applicationVersion to "Chrome" and "69.0.3497.128".


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.