此行有多个标记-构造函数RemoteWebDriver(URL,DesiredCapabilities)未定义-构造函数URL(String)未定义
'打包GridLearnings;
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;
import com.gargoylesoftware.htmlunit.javascript.host.URL;
public class GridSample {
@Test
public void TestLogin()
{
DesiredCapabilities cap= DesiredCapabilities.chrome();
cap.setBrowserName("Chrome");
cap.setPlatform(Platform.ANY);
RemoteWebDriver d =new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
}
}
'
[RemoteWebDriver
接受URL
作为参数,但来自java.net
程序包的URL。
更改import com.gargoylesoftware.htmlunit.javascript.host.URL;
至:import java.net.URL