21.6 C
New York
Tuesday, November 5, 2024

automated testing – Selenium Webdriver fails to load browser via WebDriverManager


We will run our exams in numerous browsers in selenium Webdriver, beforehand we have to executable information to run our check in any browser. However now we will obtain with out utilizing exe information & 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(){
        strive{
            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() methodology from logintest class utilizing beneath code:

public LoginPage loginpage=PageFactory.initElements(Driver.getDriver(), LoginPage.class);

However I get exception :

   SLF4J: Did not 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 info, 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.widespread.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 similar code is working with .exe information however not after we are loading via WebDriverManager.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles