当我尝试添加以下内容以在我的计算机上启用selenium节点时,我无法编译代码。
URL hubUrl = new URL("");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("firefox");
capabilities.setPlatform(Platform.LINUX);
RemoteWebDriver driver = new RemoteWebDriver(hubUrl, capabilities);
答案 0 :(得分:0)
可能您忘记添加Hub网址了。 试试这个:
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
或其他变体:
URL hubUrl = new URL("http://hubIP:hubPort/wd/hub");
DesiredCapabilities capability = DesiredCapabilities.firefox();
capabilities.setPlatform(Platform.LINUX);
RemoteWebDriver driver = new RemoteWebDriver(hubUrl, capabilities);