硒 Java - - RemoteWebDriver Error/exception
Selenium Java - - RemoteWebDriver Error/exception
java版本:1.8
selenium 版本:2017 年 4 月最新版本
Hub/grid 已在另一台机器上设置,该机器是 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 和私有 IP 以及在 windows 防火墙中打开 TCP 和 UDP 端口的网络问题 + 修改 EC2 实例中的 sec 组(windows 机器的传入端口)。
java版本:1.8
selenium 版本:2017 年 4 月最新版本
Hub/grid 已在另一台机器上设置,该机器是 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 和私有 IP 以及在 windows 防火墙中打开 TCP 和 UDP 端口的网络问题 + 修改 EC2 实例中的 sec 组(windows 机器的传入端口)。