Getting IllegalAccessError warning

0
0

I’m trying to write my first program in selenium-java but in a short program of few lines I’m getting following error:

Exception in thread “main” java.lang.IllegalAccessError: tried to access class org.openqa.selenium.os.ExecutableFinder from class org.openqa.selenium.firefox.FirefoxBinary
at org.openqa.selenium.firefox.FirefoxBinary.locateFirefoxBinariesFromPlatform(FirefoxBinary.java:418)
at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:108)
at java.util.Optional.orElseGet(Unknown Source)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:204)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:104)
at com.packt.selenium.chapter1.NavigateToAUrl.main(NavigateToAUrl.java:12)

My code is:

package com.packt.selenium.chapter1;   
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class NavigateToAUrl
{
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
}
}
  • You must to post comments
0
0

In my case it was caused by having different versions of selenium artifacts on the classpath.

I use gebish: org.grails.plugins:geb:1.1.1 which depends on:

  • org.seleniumhq.selenium:selenium-api:2.53.1
  • org.seleniumhq.selenium:selenium-remote-driver:2.53.1

on the other hand I tried to use
org.seleniumhq.selenium:selenium-firefox-driver:3.4.0

After upgrading selenium-api, selenium-remote-driver and selenium-support to version 3.4.0 everything was fine.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website