'java.lang.AbstractMethodError' when initializing the Chrome driver and Firefox driver in Selenium

I am getting the below error when initializing the Chrome driver and Firefox driver in Selenium.

Initializing the Chrome Driver

java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder.

Initializing the Firefox Driver

java.lang.AbstractMethodError: Receiver class org.openqa.selenium.firefox.GeckoDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder.

My code is below. In below code I have tried only for the Chrome and Firefox browsers.

I have tried with use of the WebDriver Manager as well as without the WebDriver Manager for the Chrome Driver initialization (As commented in the below code). For both these scenarios this error message is visible.

I have executed the same code 2 months back and it was working fine. But suddenly from yesterday I was facing this issue and up to now could not identify the root cause for this issue.

public static WebDriver initialization() {

    if (driver == null) {

        switch (propertyBrowserValue) {
            case "chrome":
               // System.setProperty(getPropertyInitializeValue(initFilePath, "chromeDriverName"), getPropertyInitializeValue(initFilePath, "chromeDriverPath"));

              //  ChromeOptions options = new ChromeOptions();
              //  options.addArguments("--remote-allow-origins=*");
              //  driver = new ChromeDriver(options);

                WebDriverManager.chromedriver().setup();
                driver = new ChromeDriver();
                break;

            case "firefox":
                WebDriverManager.firefoxdriver().setup();
                driver = new FirefoxDriver();
                break;

            case "IE":
                WebDriverManager.iedriver().setup();
                driver = new InternetExplorerDriver();
                break;

            case "Edge":
                WebDriverManager.edgedriver().setup();
                driver = new EdgeDriver();
                break;

            default:
                System.out.println("You have not setup a correct browser "
                        + "type in configuration file");
        }


    }

    driver.manage().deleteAllCookies();
    driver.manage().window().maximize();
    return driver;

}

Upvotes: 0

Views: 335

Answers (1)

varadharajan
varadharajan

Reputation: 13

Instead of setup() can you try with this,

driver = WebDriverManager.chromedriver().create();

Upvotes: 0

Related Questions