连接到LAN时无法运行selenium脚本,但连接到WIFI时工作正常。我保持所有代理设置相同。 以下是代码:
String exePath = "/usr/local/bin/chromedriver";
System.setProperty("webdriver.chrome.driver", exePath);
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
操作系统:Mac 10.11.6 硒:2.53 也尝试了3.8.1 ChromeDriver:2.33.2 Chrome:V60。 Eclipse Oxygen。
获取下面提到的错误消息:
Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 21777
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
System info: host: '01hw382197', ip: '172.25.155.171', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '9.0.4'
Driver info: org.openqa.selenium.chrome.ChromeDriver
答案 0 :(得分:0)
错误说明了一切:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
主要原因是您使用的二进制文件不兼容:
因此, Selenium Client v2.53.1 和 ChromeDriver v2.33 的发布之间存在差不多<2年的时间差
正如您所提到的那样,在连接到LAN时无法运行脚本但在连接到WIFI 时工作正常,您需要确保以下内容: