Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeOptions does not define error using Selenium

Viewed 663
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class ShootingStrategies {
public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "C:\\Users\\SP00780555\\Downloads\\chromedriver_win32\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("http://www.google.com");
}
}

At first it has run successfully, but after some time it started showing this error

Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeOptions does not define or inherit an implementation of the resolved method 'abstract boolean is(java.lang.String)' of interface org.openqa.selenium.Capabilities.
at org.openqa.selenium.remote.RemoteWebDriver.init(RemoteWebDriver.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:112)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at ShootingStrategies.main(ShootingStrategies.java:7)

I'm using intellij Can some one help me to solve this

1 Answers

This error message...

Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeOptions does not define or inherit an implementation of the resolved method 'abstract boolean is(java.lang.String)' of interface org.openqa.selenium.Capabilities.

......implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using.


Solution

Ensure that:

  • ChromeDriver is updated to current ChromeDriver v95.0 level.
  • Chrome is updated to current Chrome Version 95.0 level. (as per ChromeDriver v95.0 release notes).
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

References

You can find a relevant detailed discussion in:

Related