无法使用 TestNG Selenium 实例化类 [英] Cannot instantiate class with TestNG Selenium
本文介绍了无法使用 TestNG Selenium 实例化类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行代码时,出现以下错误:
When I run the code, I get the following error:
Cannot instantiate class mypackage.GoogleSearch
如何修复?
代码:
package mypackage;
import org.testng.annotations.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class GoogleSearch {
public String url = "http://www.google.com/";
public WebDriver driver = new FirefoxDriver();
@Test
public void search() {
driver.get(url);
}
}
推荐答案
我成功了,显然我需要安装独立服务器:https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar&can=1&q= 如果有人能解释为什么它会很棒,使用 Visual Studio 我只需要安装 selenium 客户端
I got it working, apparently I needed to install the stand-alone server: https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar&can=1&q= If anyone could explain why it'd be great, with Visual Studio I just had to install selenium client
这篇关于无法使用 TestNG Selenium 实例化类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文