我想打开显示错误的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
答案 0 :(得分:1)
错误session not created: This version of ChromeDriver only supports Chrome version 75
。因此,Chrome浏览器版本和chromedriver版本存在兼容性问题。请从以下位置根据您的chrome浏览器版本获取合适的chrome驱动程序。
答案 1 :(得分:0)
此错误消息...
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
。