我想打开显示错误的Chrome浏览器。
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Homepage { public static void main(String[] args) { // TODO Auto-generated method stub //Create Driver object System.setProperty("webdriver.chrome.driver", "C:\\Workdirectory\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); } }
在这里,我期待的是我的Chrome浏览器,但会引发类似
Starting ChromeDriver 75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40}) on port 21714 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 75 Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'DESKTOP-3JIP3OF', ip: '192.168.1.73', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101' Driver info: driver.version: ChromeDriver
此错误消息…
org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 75
…暗示 ChromeDriver v75 仅支持 Chrome浏览器v75 ,而该功能在您的系统中不可用。
您的主要问题是所使用的二进制版本之间的 不兼容性 ,如下所示:
支持 Chrome版本75
因此, ChromeDriver v75.0 和 Chrome浏览器v74.0 之间存在明显的不匹配 __
@Test