Reputation: 29
I am running the below test code, and I am getting the error: ** SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. C:\geckodriver.exe: error: Found argument '--websocket-port' which wasn't expected, or isn't valid in this context
USAGE: geckodriver.exe --port
For more information try --help
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. at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:565) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:110) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:98) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:94) at newpackage.Login.main(Login.java:17) Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely. Build info: version: '4.4.0', revision: 'e5c75ed026a' , os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_281' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:226) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:98) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:547) ... 6 more **
package neoproject;
import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
//comment the above line and uncomment below line to use Chrome
import org.openqa.selenium.chrome.ChromeDriver;
public class PG1 {
public static void main(String[] args) {
// declaration and instantiation of objects/variables
//System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
//WebDriver driver = new FirefoxDriver();
//comment the above 2 lines and uncomment below 2 lines to use Chrome
System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String baseUrl = "http://demo.guru99.com/test/newtours/";
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = "";
// launch Fire fox and direct it to the Base URL
driver.get(baseUrl);
// get the actual value of the title
actualTitle = driver.getTitle();
/*
* compare the actual title of the page with the expected one and print
* the result as "Passed" or "Failed"
*/
if (actualTitle.contentEquals(expectedTitle)){
System.out.println("Test Passed!");
} else {
System.out.println("Test Failed");
}
//close Fire fox
driver.close();
}
}
public class MyClass {
}
Thank you in advance for your aasistant.
Upvotes: 0
Views: 451
Reputation: 11
check your selenium java version and also browser version
once remove your selenium-java dependency and Add new selenium-java dependency in your pom.xml
Upvotes: 1