package xyz;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test {
System.setProperty("webdriver.firefox.FirefoxDriver","C:\\Users\\rutuj\\OneDrive\\Desktop\\New folder\\Drivers\\gecko.exe");
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
}
}

- 183,867
- 41
- 278
- 352

- 1
- 1
-
Post the full error message in your question. Also, the first thing you should do is google that error message because it's very, very likely that someone else has run into the same issue and has found and posted a solution to that problem. – JeffC Jan 30 '21 at 15:49
-
Hello Jeff, Thanks for your reply, I have googled this issue also tried all the possible ways but as i was not able to fix this issue so I have posted this issue. Please find my issue, I am getting "The type org.openqa.selenium.WebDriver is not accessible" and "The type org.openqa.selenium.firefox.FirefoxDriver is not accessible" error even after importing packages an jar files. – Rutuja Sammanwar Jan 30 '21 at 16:13
1 Answers
The System.setProperty()
key to be used is webdriver.gecko.driver
instead of webdriver.firefox.FirefoxDriver
with the value set to the absolute path of the GeckoDriver. So effectively your line of code will be:
System.setProperty("webdriver.gecko.driver","C:\\Users\\rutuj\\OneDrive\\Desktop\\New folder\\Drivers\\geckodriver.exe");
Additional consideration
As per this discussion it seems the Selenium packages can't be compiled with Java 9 due to split packages and till May 15, 2018 Selenium wasn't fully compatible with Java 9.
However, as per this comment @Jarob22 mentioned, Selenium works just fine using Java 10. Java 9 is already eol and there's not much point adding extra stuff to try and support just it if 10 works.
But with the landing of e57914a Simon introduced us with basic JPMS support. With this availability (mhomnag/selenium-java10-reproducer@bc63889) now actually builds but you may have to Remove the WebDriverWaiter and just use a sleep for now.
Java 15
As you are using JDK 15, selenium-server-standalone-3.141.59.jar is still not fully compatible with Java 11 as well as Java 15. But once Java 11 ships and Buck supports it the toolchain itll be rejigged to support Java 11.
Solution
The strategic solution will be to install the latest version of JDK 8u271 and execute the @Tests.

- 183,867
- 41
- 278
- 352