SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.46k stars 8.15k forks source link

[šŸ› Bug]: Exception while opening a CEF based application using selenium version greater than 4.13.0 #13525

Closed kv-naveen closed 8 months ago

kv-naveen commented 8 months ago

What happened?

I have used selenium 4.13.0 to open a CEF based applicaiton and it was working fine. But when I tried to update the selenium version to 4.14.0 ( or any newer version) it is failed

Find below the code that was working fine with 4.13.0

package abc.xyz;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Main {
    public static  void main(String[] args) throws InterruptedException {
       System.setProperty("webdriver.chrome.driver","C:\\TestAutomation\\src\\main\\resources\\chromedriver.exe");

        ChromeOptions options = new ChromeOptions();

        options.addArguments("--remote-debugging-port=8081");

        options.setBinary("C:\\SomeCEF.exe");

        WebDriver driver = new ChromeDriver(options);
        Thread.sleep(3000);
        driver.quit();
    }
}

How can we reproduce the issue?

Try to use any CEF(Chromium Embeded Framework) based application.

Relevant log output

`
"C:\Program Files\Microsoft\jdk-17.0.9.8-hotspot\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.5\lib\idea_rt.jar=50687:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.5\bin" -Dfile.encoding=UTF-8 -classpath C:\TestAutomation\Azure\LongView\Test\target\classes;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-java\4.14.0\selenium-java-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-api\4.14.0\selenium-api-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\4.14.0\selenium-chrome-driver-4.14.0.jar;C:\Users\*****\.m2\repository\com\google\auto\service\auto-service-annotations\1.1.1\auto-service-annotations-1.1.1.jar;C:\Users\*****\.m2\repository\com\google\guava\guava\32.1.2-jre\guava-32.1.2-jre.jar;C:\Users\*****\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\*****\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\*****\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\*****\.m2\repository\org\checkerframework\checker-qual\3.33.0\checker-qual-3.33.0.jar;C:\Users\*****\.m2\repository\com\google\errorprone\error_prone_annotations\2.18.0\error_prone_annotations-2.18.0.jar;C:\Users\*****\.m2\repository\com\google\j2objc\j2objc-annotations\2.8\j2objc-annotations-2.8.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-chromium-driver\4.14.0\selenium-chromium-driver-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-json\4.14.0\selenium-json-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-manager\4.14.0\selenium-manager-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v116\4.14.0\selenium-devtools-v116-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v117\4.14.0\selenium-devtools-v117-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v118\4.14.0\selenium-devtools-v118-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v85\4.14.0\selenium-devtools-v85-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\4.14.0\selenium-edge-driver-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\4.14.0\selenium-firefox-driver-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-http\4.14.0\selenium-http-4.14.0.jar;C:\Users\*****\.m2\repository\dev\failsafe\failsafe\3.3.2\failsafe-3.3.2.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\4.14.0\selenium-ie-driver-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\4.14.0\selenium-remote-driver-4.14.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-api\1.28.0\opentelemetry-api-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-context\1.28.0\opentelemetry-context-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-exporter-logging\1.28.0\opentelemetry-exporter-logging-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk-metrics\1.28.0\opentelemetry-sdk-metrics-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-extension-incubator\1.28.0-alpha\opentelemetry-extension-incubator-1.28.0-alpha.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk-logs\1.28.0\opentelemetry-sdk-logs-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk-common\1.28.0\opentelemetry-sdk-common-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk-extension-autoconfigure-spi\1.28.0\opentelemetry-sdk-extension-autoconfigure-spi-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk-extension-autoconfigure\1.28.0\opentelemetry-sdk-extension-autoconfigure-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-api-events\1.28.0-alpha\opentelemetry-api-events-1.28.0-alpha.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk-trace\1.28.0\opentelemetry-sdk-trace-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-sdk\1.28.0\opentelemetry-sdk-1.28.0.jar;C:\Users\*****\.m2\repository\io\opentelemetry\opentelemetry-semconv\1.28.0-alpha\opentelemetry-semconv-1.28.0-alpha.jar;C:\Users\*****\.m2\repository\net\bytebuddy\byte-buddy\1.14.5\byte-buddy-1.14.5.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-os\4.14.0\selenium-os-4.14.0.jar;C:\Users\*****\.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\4.14.0\selenium-safari-driver-4.14.0.jar;C:\Users\*****\.m2\repository\org\seleniumhq\selenium\selenium-support\4.14.0\selenium-support-4.14.0.jar isw.qcoe.Main
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response:  
Host info: host: '******', ip: '**************'
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
    at isw.qcoe.Main.main(Main.java:41)
Caused by: org.openqa.selenium.json.JsonException: Unable to parse: 
    at org.openqa.selenium.json.Json.toType(Json.java:169)
    at org.openqa.selenium.json.Json.toType(Json.java:152)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:122)
    ... 13 more
Caused by: org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read: 
Build info: version: '4.14.0', revision: 'e5a96349ce'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.9'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.json.JsonInput.expect(JsonInput.java:443)
    at org.openqa.selenium.json.JsonInput.beginObject(JsonInput.java:331)
    at org.openqa.selenium.json.MapCoercer.lambda$apply$1(MapCoercer.java:64)
    at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:174)
    at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:149)
    at org.openqa.selenium.json.Json.toType(Json.java:206)
    at org.openqa.selenium.json.Json.toType(Json.java:167)
    ... 15 more

Process finished with exit code 1

`

Operating System

Windows 11

Selenium version

Java 4.14.0

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 89 Browser 89

Are you using Selenium Grid?

No

github-actions[bot] commented 8 months ago

@kv-naveen, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

diemol commented 8 months ago

Does this happen when you use 4.17.0?

kv-naveen commented 8 months ago

@diemol Yes.

diemol commented 8 months ago

Can you share a CEF based application so we can triage this? Also some docs about this would be helpful.

titusfortner commented 8 months ago

The most likely cause of a bug like this is a mismatched chromedriver version. Is there a custom driver? Are you matching the correct chrome version?

kv-naveen commented 8 months ago

It may not be an issue with mismatched chromedriver issue as the same driver works fine with 4.13.0 but fails when the java client is updated to 4.14.0

kv-naveen commented 8 months ago

Can you share a CEF based application so we can triage this? Also some docs about this would be helpful.

Slack \ Githubdesktop are some applications or we can build a sample using https://github.com/acristoffers/CEF3SimpleSample

diemol commented 8 months ago

I know 4.14.0 has changes to work with changes ChromeDriver had around those days.

Since you are using a quite old ChromeDriver version... is there any reason to not upgrade that?

titusfortner commented 8 months ago

Selenium explicitly provides support to the current version of Chrome and 2 previous versions, so anything before Chrome 119 right now we aren't likely to troubleshoot. Please update chromedriver / chrome versions and provide a reproduction. Thank you.

kv-naveen commented 8 months ago

I know 4.14.0 has changes to work with changes ChromeDriver had around those days.

Since you are using a quite old ChromeDriver version... is there any reason to not upgrade that?

It is a legacy application needs lot of time to upgrade the chrome in that applicaiton.

titusfortner commented 8 months ago

I'm setting expectations that if you can't use the latest version of Chrome, it is likely that you will not be able to use the latest version of Selenium, either. Maybe there is something that can be done for us to better support older versions, but figuring out what that is and addressing it is out of scope for our current workload.

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.