I am getting this message all the time but in pom.xml I didn't use this library at all. It also says something wrong with Chromdriver and I can't understand what exactly wrong am I doing: Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Can someone help me please?
Snapshot of pom.xml
Snapshot of code:
CodePudding user response:
@ZarinaBakchieva I feel the message "Failed to load class "org.slf4j.impl.StaticLoggerBinder", you can look at this link SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
For the other problem: "Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: " You can try and upgrade your chromedriver version. Sometimes your browser gets auto upgraded to the latest version while chromedriver becomes stale for this upgraded version.
For more details look at this - UnreachableBrowserException
CodePudding user response:
You have two errors here. The first error message...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
...implies that either you have a slf4j
dependency in your pom.xml
and the version is not compatible with the other binaries.
Solution
Upgrade slf4j
dependency to the latest stable SLF4J Simple Binding version using the following dependency:
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
You can find a relevant detailed discussion in SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
The second error message...
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
...implies that a new session can't be initialized bcause of invalid address of the remote server or browser start-up failure.
Possibly you are compiling your program using java-17. Ideally you need to compile the Selenium program with java-8 through pom.xml
dependency:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>