0

Below is my code, which is so basic. But upon running I am getting,

Error: Unable to initialize main class testPackage.myTestClass Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver

......

package testPackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class myTestClass {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
        WebDriver driver;
        System.setProperty("webdriver.chrome.driver", "/Users/reshmabibin/Downloads/chromedriver.exe");
        driver= new ChromeDriver();
        driver.get("https://artoftesting.com/selenium-tutorial");
        driver.quit();
        System.out.println("https://artoftesting.com/selenium-tutorial");
    

    }   }

    

I am not sure , If I have added the path correctly or not. I am using mac.

1 Answer 1

0

It's because you haven't set classpath to your selenium jar download this

And if you are a ubuntu user the below command will be used to set classpath

export CLASSPATH=:./selenium-server-4.4.0.jar

Compile and run it again.

for reference selenium dev click this

Hope it helps

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.