gpt4 book ai didi

java - 无法使用 TestNG Selenium 实例化类

转载 作者:太空宇宙 更新时间:2023-11-04 06:32:53 25 4
gpt4 key购买 nike

当我运行代码时,出现以下错误:

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 客户端

关于java - 无法使用 TestNG Selenium 实例化类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25860587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com