Closed swasagarwal123 closed 1 year ago
@swasagarwal123 - I think you need to ensure that you have https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver as a maven dependency in your pom file.
Hey @krmahadevan I did what you suggested I now have a new error
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Handshake response does not match any supported protocol. Response payload: {"sessionId":"e831ea1cfe1c3081649c8378ddc78c81","status":33,"value":{"message":"session not created exception: Missing or invalid capabilities\n (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.19044 x86_64)"}}
Host info: host: 'NLLH4000548538', ip: '192.168.1.72'
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '20.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*], extensions: []}}]}]
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$2(ProtocolHandshake.java:154)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:150)
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:531)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:154)
at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:107)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:87)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:50)
at com.***.amr.amrrestcaapi.App.main(App.java:10)
@swasagarwal123, thank you for creating this issue. We will troubleshoot it as soon as we can.
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!
@swasagarwal123 - Have you tried ensuring that you have the latest chromedriver ?
@krmahadevan so I just downloaded and used the latest chromeDriver just to see if that was the issue. Now a window pops up but then the app crashes and I get this error Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited normally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Host info: host: 'NLLH4000548538', ip: '192.168.1.72' Build info: version: '4.10.0', revision: 'c14d967899' System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '20.0.1' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*], extensions: []}}]}] at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:140) 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:531) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:154) at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:107) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:87) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:50) at com.***.amr.amrrestcaapi.App.main(App.java:10)
@swasagarwal123 - I believe that the Selenium should be able to automatically download the version of chromedriver that is required to work with your chrome browser version. Can you please clean up all chromedriver executables in your path and also remove the setting up of its path via JVM arguments and try again? The issue you are seeing is totally due to a mismatch between chrome browser and chromedriver executable.
@krmahadevan can you please explain what you mean? I am a bit confused. Should I remove this dependency
`
<artifactId>selenium-chrome-driver</artifactId>
<version>4.10.0</version>
</dependency>`
?
Or are asking me to change something in the "Edit system environment variables" panel? or something else? I am using Intellij btw.
I am not asking you to remove any maven dependency. That is required so that you can use the classes that are part of those jars. I am asking you to specifically remove any references to chromedriver.exe
that you may have anywhere in your system, which includes your IDE and your PATH variable.
@krmahadevan Ok so I removed the reference to chrome driver in my ide. I also check my echo %PATH% to see if there were any reference to chromedriver and there was none C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH \;C:\Program Files\SafeNet\Authentication\SAC\x64;C:\Program Files\SafeNet\Authentication\SAC\x32;C:\Program Files\ServiceNow\agent-client-collector\bin;C:\Program Files\ServiceNow\age nt-client-collector\embedded\bin;C:\Program Files\Git\cmd;C:\Program Files\NodeJS 18\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Windows\system32\c onfig\systemprofile\AppData\Roaming\npm;C:\Program Files\apache-maven-3.8.3\bin;C:\Users\B12956\AppData\Local\Microsoft\WindowsApps;
and i am getting the same error, a screen pops up then the app crashes
@krmahadevan I also checked my chrome version - 114.0.5735.199, I removed all instances of a chrome driver from ide and path. I check on echo %PATH%, I then tried to download the compatible chromdriver https://chromedriver.storage.googleapis.com/index.html?path=114.0.5735.90/ to manually set it, but again got the same error, any ideas why its still happening?
That error is most likely related to your machine. Can you reproduce the same issue on a different host?
@diemol @krmahadevan I am trying this on my work laptop, I tried the same thing on my personal laptop and it does seem to be working, why would that be the case, is there a specific thing I can show you that could be causing the issue?
You need to reach out to your IT area to understand what restrictions your work laptop has. It might be security permissions, or just anything your company configures there.
@diemol I noticed that my personal computer and work computer had different chrome versions, could that be something that could be causing the error?
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.
What happened?
I keep getting NoClassDefFoundError Exception while trying to selenium on my maven spring boot project.
How can we reproduce the issue?
Relevant log output
Operating System
Windows 10
Selenium version
4.10.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
Are you using Selenium Grid?
no