0

New to SO & test automation & selenium. I got introduced to gitpod while attempting https://www.lambdatest.com/certifications/.

I'm stuck trying to run the below simple code snippet in side Gitpod.

package project.maven.selenium;
import org.openqa.selenium.WebDriver;
import io.github.bonigarcia.wdm.WebDriverManager;

public class WebDriverManagerDemo {

    public static void main(String[] args) throws InterruptedException {
        
        WebDriver driver = WebDriverManager.chromedriver().create();
        
        // Navigate to the demoqa website
        driver.get("https://www.lambdatest.com/selenium-playground/checkbox-demo");
        Thread.sleep(3000);
        
        driver.quit();

    }
        
}

Couldn't find a way pass the error below,

Exception in thread "main" io.github.bonigarcia.wdm.config.WebDriverManagerException: There was an error creating WebDriver object for Chrome at io.github.bonigarcia.wdm.WebDriverManager.instantiateDriver(WebDriverManager.java:1775) at io.github.bonigarcia.wdm.WebDriverManager.create(WebDriverManager.java:425) at project.maven.selenium.WebDriverManagerDemo.main(WebDriverManagerDemo.java:9) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

Can someone please point out what I'm doing wrong here?

Researched hours but Selenium on Gitpod is not much of a topic, read the getting started guide with Gitpod too, to find a resolution to my problem but no luck before posting here.

1 Answer 1

0

Below line of code is incorrect:

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

Try the below code:

 public static void main(String[] args) throws InterruptedException {
        
        // below line is used to setup chromedriver using WDM
        WebDriverManager.chromedriver().setup();

        //initialize the driver object
        WebDriver driver = new ChromeDriver();
        
        // Navigate to the demoqa website
        driver.get("https://www.lambdatest.com/selenium-playground/checkbox-demo");
        Thread.sleep(3000);
        
        driver.quit();

    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.