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– IAmMilinPatel2016年09月19日 07:44:51 +00:00Commented 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.user21268– user212682016年09月19日 07:59:56 +00:00Commented 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.htmIAmMilinPatel– IAmMilinPatel2016年09月19日 08:20:51 +00:00Commented Sep 19, 2016 at 8:20
-
@TESTast testng plugin is 6.9.0 Why it is not working?user21268– user212682016年09月19日 08:23:18 +00:00Commented 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.Lesmana Sitepu– Lesmana Sitepu2016年11月21日 10:45:15 +00:00Commented Nov 21, 2016 at 10:45
1 Answer 1
Usually this issue come due to version of TestNG Plugin. So please upgrade your TestNG plugin
-
Link only answers usually get removed. Want to write the solution here?IAmMilinPatel– IAmMilinPatel2016年09月24日 03:36:16 +00:00Commented Sep 24, 2016 at 3:36