Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86869

Unrecognized Chrome version when using Selenium and Chromedriver

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.15.0
    • WebEngine
    • None
    • Chromedriver v80 with WebEngine 5.15 on Windows
    • 03d399308 (118-based), 1ad96f19f (118-based), dbfa94722 (dev)

    Description

      We're using Selenium for automation with QtWebEngine 5.15. Ran into an issue where our application starts normally, but the Chromedriver crashes with an "Unrecognized Chrome Version" error.

       

      I've attached a simple QT App and Selenium java program to repro the issue. I've also attached the java file to show the Selenium code used.

      To repro:

      • Unzip and build the SimpleQtHtmlPage application, then run it
      • Unzip the Java jar, put it in the same folder as the chromdriver.exe and run
      java -jar <path to jar>

       Expected: Chromedriver can connect successfully to the WebEngine

      Actual:  Chromedriver is not able to connect, with the following error:

      Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot connect to chrome at localhost:9222
      from unknown error: unrecognized Chrome version: SimpleQtHtmlPage/
      

      The workaround we've found is to set the QApplication ApplicationName to "Chrome" and ApplicationVersion to "80.0.3987.163". This is a regression as it was not necessary in previous versions of using these softwares together, we have successfully used Selenium for automation with QT 5.10 

       

      ContentBrowserClient::GetProduct was added for compatibility with Chromium 73, in this change]

      Chromium sets the browser version by calling GetProduct, which returns ApplicationName/ApplicationVersion. The chromium code is here

       

      In our actual application, we cannot change our ApplicationName and ApplicationVersion, so we've added code to ContentBrowserClient::GetProduct to return "Chrome/CHROMIUM_VERSION" if an environment variable is set, which means that it's being run using automation.

       Is there a way to set the Browser name/version, without changing QApplication::ApplicationName and QApplication::ApplicationVersion?

      Attachments

        1. chromedriver.exe
          7.70 MB
        2. SeleniumExample.java
          1 kB
        3. SeleniumSendText.zip
          9.09 MB
        4. SimpleQtHtmlPage.zip
          8 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              pvarga Peter Varga
              abgray Abigail Gray
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes