gpt4 book ai didi

java - Selenium Java - - RemoteWebDriver 错误/异常

转载 作者:行者123 更新时间:2023-11-30 06:46:15 26 4
gpt4 key购买 nike

java版本:1.8

selenium 版本:最新截至 2017 年 4 月

集线器/网格已设置在另一台机器上,该机器是 ec2 windows 实例。节点注册成功。

集线器和节点控制台上没有错误。我可以在浏览器上看到控制台,其中包含已注册的节点和公开的浏览器。

java -Dwebdriver.gecko.driver=C:\selenium_grid\geckodriver\geckodriver.exe -jar selenium-server-standalone-3.4.0.jar -role hub -host <ipaddress> -port 4444

java -jar selenium-server-standalone-3.4.0.jar -role node -port 5555 -hub http://127.0.0.1:4444/grid/register -browser "browserName=firefox,platform=WINDOWS" -browser "browserName=opera,platform=WINDOWS" -browser "browserName=safari,platform=WINDOWS" -browser "browserName=internet explorer,platform=WINDOWS" -browser "browserName=chrome,platform=WINDOWS"

<小时/>

webdriver = new RemoteWebDriver(seleniumGridURL, desiredCapabilities);

public enum DriverType implements DriverSetup {

FIREFOX {
public DesiredCapabilities getDesiredCapabilities(Proxy proxySettings) {
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
return addProxySettings(capabilities, proxySettings);
}

public WebDriver getWebDriverObject(DesiredCapabilities capabilities) {
return new FirefoxDriver(capabilities);
}
}}`
<小时/>

错误: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:353)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
at com.website.selenium.config.DriverFactory.instantiateWebDriver(DriverFactory.java:86)
at com.website.selenium.config.DriverFactory.getDriver(DriverFactory.java:42)
at com.website.selenium.DriverBase.getDriver(DriverBase.java:34)
at com.website.selenium.listeners.ScreenshotListener.onTestFailure(ScreenshotListener.java:51)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1716)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1699)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:703)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

org.openqa.selenium.WebDriverException:
Unable to parse remote response: Cannot POST /wd/hub/session

尝试按照建议启用调试:
java -jar selenium-server-standalone-3.4.0.jar -debug -log c:\selenium_grid\grid.log -role node -port 5555 -hub http://127.0.0.1:4444/grid/register -browser "browserName=firefox,platform=WINDOWS" -browser "browserName=opera,platform=WINDOWS" -browser "browserName=safari,platform=WINDOWS" -browser "browserName=internet explorer,platform=WINDOWS" -browser "browserName=chrome,platform=WINDOWS"

Exception in thread "main" com.beust.jcommander.ParameterException: "-debug": couldn't convert "-log" to a boolean

最佳答案

这是 aws VPC 和私有(private) IP 以及在 Windows 防火墙中打开 TCP 和 UDP 端口 + 修改 EC2 实例中的 sec 组(Windows 计算机的传入端口)的网络问题。

关于java - Selenium Java - - RemoteWebDriver 错误/异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43645595/

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