Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium: 'package org.openqa.selenium does not exist'

Tags:

java

selenium

Terminal: Error message

Eclipse IDE: Program set-up

Receiving two (2) error messages:

package org.openqa.selenium does not exist
package org.openqa.selenium.chrome does not exist

Here's what my program looks like: MyClass.java

package newPackage;

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

public class MyClass {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver",
                "/Users/Informatics/Downloads/chromedriver.exe");

        WebDriver driver = new ChromeDriver();
        driver.get("google.com");

        driver.close();
    }
}

p.s. I'm using the newest versions of Eclipse, Selenium, Chrome and Java.

like image 327
at-bernard Avatar asked Jul 01 '26 10:07

at-bernard


1 Answers

If ur using intellijIdea add this in dependencies in build.gradle file

implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.1.1'

I have added as testimplementation group so got error , it should be implementation group to add all jars

like image 170
Rakesh A Avatar answered Jul 03 '26 01:07

Rakesh A



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!