We will run our checks in numerous browsers in selenium Webdriver, beforehand we have to executable recordsdata to run our check in any browser. However now we will obtain with out utilizing exe recordsdata & with the assistance of WebDriverManager following beneath syntax to open chrome browser.
WebDriverManager.iedriver().setup();
driver = new ChromeDriver();
Driver class I’ve outlined beneath code:
public static WebDriver getDriver(){
attempt{
if(driver == null) {
/* PropertiesFileReader obj=new PropertiesFileReader();
Properties properties=obj.getproperty();
openBrowser(properties.getProperty("browserName"), properties.getProperty("URL")); */
WebDriverManager.iedriver().setup();
driver = new ChromeDriver();
}
}catch(Exception e) {
e.printStackTrace();
}
return driver;
}
I’ve login web page and logintestcase, I’m calling getDriver()
technique from logintest class utilizing beneath code:
public LoginPage loginpage=PageFactory.initElements(Driver.getDriver(), LoginPage.class);
However I get exception :
SLF4J: Didn't load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for additional particulars.
java.lang.IllegalStateException: The trail to the motive force executable should be set by the webdriver.chrome.driver system property; for extra data, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The newest model could be downloaded from http://chromedriver.storage.googleapis.com/index.html
at com.google.frequent.base.Preconditions.checkState(Preconditions.java:843)
at org.openqa.selenium.distant.service.DriverService.findExecutable(DriverService.java:135)
at org.openqa.selenium.chrome.ChromeDriverService.entry$000(ChromeDriverService.java:35)
and identical code is working with .exe
recordsdata however not once we are loading by means of WebDriverManager.