0

I'm very new to Selenium. Below given is my first test script.

package package1;

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

public class Tutorials1 {

public static void main(String[] args) {
 String exepath="C:\\Users\\sh370472\\Desktop\\chromedriver_win32/chromedriver.exe";
System.setProperty("webdriver.chrome.driver", exepath);
WebDriver driver=new ChromeDriver();
driver.get("https://www.shipper-ml.com");
driver.findElement(By.id("inpUserId")).sendKeys("xxxxxxxx");
driver.findElement(By.id("inpPassword")).sendKeys("xxxxxxxxxxxxxx");
driver.findElement(By.id("btnLogonLabel")).click();

}

}

While executing the above code I am getting below exceptions :

Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter.<init>(Ljava/util/concurrent/ExecutorService;)V from class org.openqa.selenium.net.UrlChecker
    at org.openqa.selenium.net.UrlChecker.<init>(UrlChecker.java:48)
    at org.openqa.selenium.chrome.ChromeDriverService.start(ChromeDriverService.java:164)
    at org.openqa.selenium.chrome.ChromeCommandExecutor.execute(ChromeCommandExecutor.java:46)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:415)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:139)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:94)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:144)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:86)
    at package1.Tutorials1.main(Tutorials1.java:12)
Starting ChromeDriver 2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a) on port 17780
Only local connections are allowed.

NOTE : Also tried executing the same script from Internet Explorer also, still getting the same. It just opens the browser and closes(because of finally block) it.

Can anyone please suggest if I am missing anything.

Shivangi
  • 5
  • 8
  • Change your exe path to appropriate and if you still have issue, then this [link](https://stackoverflow.com/questions/7076414/java-lang-illegalaccesserror-tried-to-access-method) might be a break through – Dhamo Oct 29 '18 at 04:06
  • chrome driver version , chrome browser version ? – cruisepandey Oct 29 '18 at 04:57
  • Tried but no success. – Shivangi Oct 29 '18 at 05:02
  • ChromeDriver version : 2.35.528161 Chrome Browser version : Version 65.0.3325.162 – Shivangi Oct 29 '18 at 05:03
  • I ran your code and it's successfully execute. So may be there is an issue in your chromedriver and selenium jar file version. Check it both version once. Check here https://sites.google.com/a/chromium.org/chromedriver/downloads – Hiten Oct 29 '18 at 05:10
  • @Shivangi use Double Back Slash (\\) in your path before chromedriver.exe – Dhru 'soni Oct 29 '18 at 05:17
  • @Hiten, but I am not getting the output. Can you tell me the reason. – Shivangi Oct 29 '18 at 06:02
  • @Shivangi you need to download the 2.37 chrome version which supports the 64-66 chrome. Your current chrome version supports 62-64 chrome browser. Download from here :: https://chromedriver.storage.googleapis.com/index.html?path=2.37/ – Hiten Oct 29 '18 at 06:51
  • Hi Hiten, I am still getting the same error. – Shivangi Oct 29 '18 at 08:28
  • Hi Hiten, Its working now. Thanks. I have one more question, can you please tell me can I link Jquery code with java code ? If yes, then how to do it ? – Shivangi Oct 30 '18 at 05:49

1 Answers1

0

I also got same error 5 days back after some research I got to know my chrome driver version is not compatible with the selenium version so I just upgraded my chromedriver.exe file version and everything works perfectly.

Bharadwaj Pendyala
  • 324
  • 1
  • 3
  • 16