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)

  • which version of TestNG (Plugin and the JAR) are you using? – IAmMilinPatel Sep 19 '16 at 7:44
  • @TESTasy. I am using latest version. selenium server standalone 3.0 beat3.jar. and how I check my testng plugin. – user21268 Sep 19 '16 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 – IAmMilinPatel Sep 19 '16 at 8:20
  • @TESTast testng plugin is 6.9.0 Why it is not working? – user21268 Sep 19 '16 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. – Lesmana Sitepu Nov 21 '16 at 10:45
1

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

Change Log of TestNG

Issue Reported

  • Link only answers usually get removed. Want to write the solution here? – IAmMilinPatel Sep 24 '16 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy