Search code examples
javaseleniumselenium-chromedriverjava-modulejava-13

"java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module" error with ChromeDriver Selenium


I am using eclipse 09-2019 with jdk13 and selenium 3.0.1 .jar file.

My Code is:

package package1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Script1
{
      public static void main(String[] args)
      {
          System.out.println("Hii");
          System.setProperty("Webdriver.chrome.driver","E:\\Selenium\\chromedriver.exe");
          WebDriver driver=new ChromeDriver();
          driver.get("http://www.google.com");
      }
}

Error:

java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module

Solution

  • InvalidModuleDescriptorException

    InvalidModuleDescriptorException is thrown when reading a module descriptor and the module descriptor is found to be malformed or otherwise cannot be interpreted as a module descriptor.

    InvalidModuleDescriptorException can be raised in either of the following scenarios:

    1. Issues with the Java project.
    2. Issues with the Java package with in a Java project.
    3. Issues with the Java class with in a Java package.

    However, as per the discussion in Does Selenium v3.141 support Java 13? it seems the latest version of Selenium still doesn't supports .


    Solution

    The strategic solution will be to install the latest version of JDK 8u222 and execute the @Tests

    Additionally, you also need to replace uppercap W with the lowercap w in the System.setProperty() line. So, effectively, you need to replace:

    System.setProperty("Webdriver.chrome.driver","E:\\Selenium\\chromedriver.exe");
    

    With

    System.setProperty("webdriver.chrome.driver","E:\\Selenium\\chromedriver.exe");
    

    Additional Consideration

    Additionally, ensure that: