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)