在使用selenium启动谷歌Chrome浏览器的时候,是需要用到chromedirver的,两者之间的版本是需要匹配的,否则会出现下面类似的报错:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.31)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86)
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
这个例子中就是因为谷歌浏览器用的是65的版本,chromedriver用的是2.33的版本,而对于谷歌65的版本来说,与它匹配的chromedriver的版本是2.37或2.38,不匹配时就会出现上面的错误,使用匹配的版本后该问题即可解决。
下面是谷歌浏览器与chromedriver的版本对应关系,供参考:
------------兼容版本对照表-----------
注:支持chromeV74版本的driver版本号比较特别一点,不知道之后会不会回归以前正常的版本
ChromeDriver 78.0.3904.11 (-09-12)---------Supports Chrome version 78ChromeDriver 77.0.3865.40 (-08-20)---------Supports Chrome version 77 ChromeDriver 76.0.3809.12 (-06-07)---------Supports Chrome version 76ChromeDriver 75.0.3770.8 (-04-29)---------Supports Chrome version 75ChromeDriver v74.0.3729.6 (-03-14)--------Supports Chrome v74ChromeDriver v2.46 (-02-01)----------Supports Chrome v71-73--------以下为兼容版本对照表-------ChromeDriver v2.45 (-12-10)----------Supports Chrome v70-72ChromeDriver v2.44 (-11-19)----------Supports Chrome v69-71ChromeDriver v2.43 (-10-16)----------Supports Chrome v69-71ChromeDriver v2.42 (-09-13)----------Supports Chrome v68-70ChromeDriver v2.41 (-07-27)----------Supports Chrome v67-69ChromeDriver v2.40 (-06-07)----------Supports Chrome v66-68ChromeDriver v2.39 (-05-30)----------Supports Chrome v66-68ChromeDriver v2.38 (-04-17)----------Supports Chrome v65-67ChromeDriver v2.37 (-03-16)----------Supports Chrome v64-66ChromeDriver v2.36 (-03-02)----------Supports Chrome v63-65ChromeDriver v2.35 (-01-10)----------Supports Chrome v62-64