3
  1. While running the script in local machine with chrome driver, i am getting the following error, but the same script is working fine with firefox. i am using selenium-java 2.48.2 and chrome driver 2.20

error log..

java.lang.NoSuchMethodError: org.openqa.selenium.remote.service.DriverCommandExecutor.<init>(Lorg/openqa/selenium/remote/service/DriverService;Ljava/util/Map;)V

at org.openqa.selenium.chrome.ChromeDriverCommandExecutor.<init>(ChromeDriverCommandExecutor.java:40)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at com.ancestry.systemtest.TestNGTestBase.setUp(TestNGTestBase.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:589)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

2.Test ignored.

java.lang.NullPointerException
at com.ancestry.systemtest.TestNGTestBase.getSessionId(TestNGTestBase.java:177)
at com.saucelabs.testng.SauceOnDemandTestListener.onTestStart(SauceOnDemandTestListener.java:93)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1700)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1675)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:619)
at org.testng.internal.Invoker.retryFailed(Invoker.java:967)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Hamad
  • 5,096
  • 13
  • 37
  • 65
Shiva Krishna
  • 103
  • 1
  • 2
  • 5

2 Answers2

3

I had the similar error and adding following dependency solved it -

      <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-remote-driver</artifactId>
      <version>2.48.2</version>
      </dependency>

Scanning thought the stack trace and reaching the faulty class helped me analyze that my current version of class was not up to date.

Tarun
  • 3,456
  • 10
  • 48
  • 82
  • Hi, I am implementing Headless chrome testing using below mentioned tools: - Ubuntu14.04LTS. - chrome browser - chromedriver binary. - Xvfb(for headless Chrome) - TestNG. - required jar files Selenium,chromedriver and TestNG. My complete setup works perfectly fine on my local, however it does not works on another server where I have performed the whole setup. My error is: java.lang.NoSuchMethodError:org.openqa.selenium.chrome.ChromeDriverService$Builder.usingDriverExecutable(Ljava/io/File;)Lorg/openqa/selenium/remote/service/DriverService$Builder; at utilities.Testing.main. HELP – kaustubh Apr 22 '17 at 06:01
1

It is an issue with the dependencies. The required selenium jar files are not added in the project build path Also check if the ChromeDriver.exe path is specified correctly in the code System.setProperty("webdriver.chrome.driver","chromedriver exe path");

Anitha
  • 36
  • 1