我刚刚将Selenium升级到4.0.0。更新后,我无法打开Chrome或Firefox。以下是详细信息Chrome:96
铬驱动程序:支持96。下载自https://chromedriver.storage.googleapis.com/index.html?path=96.0.4664.45/
硒:4.0.0
这是打开浏览器的代码
System.setProperty("webdriver.chrome.driver", "<chromedriver location>");<br>
driver = new ChromeDriver();
浏览器打开一瞬间,然后关闭。这是我得到的错误
AILED CONFIGURATION: @BeforeClass beforeClassSetup("chrome")
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.0.0', revision: '3a21814679'
System info: host: 'dkleinman.esri.com', ip: 'fe80:0:0:0:23:8798:b33c:2bf6%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '16.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}}]
如果我将硒降低到3.14(将铬保持在96(,效果会很好
Selenium和java-16 之间可能存在兼容性问题
一个可能的解决方案是用稳定的最新JDK 8u311取代java.version: '16.0.1'