我们正在将以前工作的Selenium/Java/Chrome 测试配置升级到更新版本:
ChromeDriver 2.35 -> 75.0.3770.90
Selenium Java 3.14 -> 3.141.59
macOS 10.14.5 (unchanged)
Java 11.0.3 (unchanged)
Chrome 75.0.3770.100 (unchanged)
然而,当尝试运行 Selenium 测试时,我们看到:
java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:28719
完整的堆栈/日志:
Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}) on port 28719
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Jun 26, 2019 10:45:03 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
...
org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:28719
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Craigs-iMac.local', ip: '192.168.1.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '11.0.3'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByTagName(RemoteWebDriver.java:396)
at org.openqa.selenium.By$ByTagName.findElement(By.java:320)
我在这方面找到的所有资源都建议使用--whitelisted-ips='',这没有效果,或者与不兼容的Selenium/Chrome/ChromeDriver 版本有关,我认为这不是这里的问题。
更新:我可以确认驱动程序已启动,并且正在侦听端口28719,但随后会在启动和实际测试执行之间的某个时刻停止。我没有发现与关机相关的错误/日志记录。
更新 2:我已经调试过了,发送到远程驱动程序的初始命令成功了(setWindowSize()),但是这一行导致驱动程序静默死去:
((WebStorage) driver).getLocalStorage().setItem("token", token);
慕哥9229398
UYOU
相关分类