0
import org.openqa.selenium.*;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Grid_2 
{
 WebDriver driver;
 String baseURL,nodeURL;
@BeforeTest
public void setup() throws MalformedURLException
{
 baseURL="http://54.68.159.204.qmsadm";
 nodeURL="http://192.168.1.120:5566/wd/hub";
 DesiredCapabilities capability=DesiredCapabilities.firefox();
 capability.setBrowserName("firefox");
 capability.setPlatform(Platform.LINUX);
 driver=new RemoteWebDriver(new URL(nodeURL),capability);
}
@AfterTest
public void afterTest()
{
 driver.quit();
}
@Test
public void simpleTest()
{
 driver.get(baseURL);
 Assert.assertEquals("Qber Admin - A new way of Token System",driver.getTitle());
}
}

I am just running my project using selenium grid. i connected the hub and node. I wrote the test script. And click on run button it display the error message.Here is my error:

Exception in thread "main" java.lang.NoSuchMethodError: org.testng.internal.Utils.defaultIfStringEmpty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; at org.testng.remote.AbstractRemoteTestNG.setHost(AbstractRemoteTestNG.java:59) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)

Niels van Reijmersdal
32.7k4 gold badges59 silver badges125 bronze badges
asked Sep 19, 2016 at 7:04
5
  • which version of TestNG (Plugin and the JAR) are you using? Commented Sep 19, 2016 at 7:44
  • @TESTasy. I am using latest version. selenium server standalone 3.0 beat3.jar. and how I check my testng plugin. Commented Sep 19, 2016 at 7:59
  • testng.org/doc/eclipse.html this might help with checking the version. OR This: tutorialspoint.com/testng/testng_plug_with_eclipse.htm Commented Sep 19, 2016 at 8:20
  • @TESTast testng plugin is 6.9.0 Why it is not working? Commented Sep 19, 2016 at 8:23
  • Could you confirm that the plugin you used is latest release 6.9.12.2016xxxxxxxx, or even you can try with the latest beta testng.org/eclipse-beta. Also, make sure there is only one testing on your classpath, either the fat jar of selenium or the stock testing jar. Hope this helps. Commented Nov 21, 2016 at 10:45

1 Answer 1

1

Usually this issue come due to version of TestNG Plugin. So please upgrade your TestNG plugin

Change Log of TestNG

Issue Reported

answered Sep 20, 2016 at 6:46
1
  • Link only answers usually get removed. Want to write the solution here? Commented Sep 24, 2016 at 3:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.