Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error occurred during initialization of boot layer : Unable to derive module descriptor error with Selenium and java [duplicate]

When I tried to set up selenium in eclipse, after adding jar files, while running the program , I am getting the below error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Program Files\Selenium\Lib\selenium-server-standalone-3.141.59 (2).jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.eclipse.jetty.http.Http1FieldPreEncoder not in module.
like image 559
SAVI S Avatar asked May 28 '26 00:05

SAVI S


1 Answers

I had similar issue, the problem i faced was i added the selenium-server-standalone-3.141.59.jar under modulepath instead it should be under classpath

so select classpath via (project -> Properties -> Java Bbuild Path -> Libraries) add the downloaded latest jar

After adding it must be something like this

enter image description here

And an appropriate driver for browser has to be downloaded for me i checked and downloaded the same version of chrome for chrome driver and added in the C:\Program Files\Java

And following is the code that worked fine for me

    public class TestuiAautomation {

        public static void main(String[] args) {

            System.out.println("Jai Ganesha");
            try {
                System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Java\\chromedriver.exe");
                System.out.println(System.getProperty("webdriver.chrome.driver"));
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions.addArguments("no-sandbox");
                chromeOptions.addArguments("--test-type");
                chromeOptions.addArguments("disable-extensions");
                chromeOptions.addArguments("--start-maximized");
                WebDriver driver = new ChromeDriver(chromeOptions);
                driver.get("https://www.google.com");
                System.out.println("Google is selected");
            } catch (Exception e) {
                System.err.println(e);
            }

        }

    }

For reference

and check for the browser version and chromedriver version

like image 74
Parameshwar Avatar answered May 30 '26 16:05

Parameshwar