Java SessionNotCreatedException: session not created: 此版本的 ChromeDriver 仅支持使用 Selenium ChromeDriver 的 Chrome 版本 77
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/57567812/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 77 using Selenium ChromeDriver
提问by YSam Kabir
I am using ChromeDriver 77.0.3865.10
我正在使用 ChromeDriver 77.0.3865.10
Google Chrome Version 76.0.3809.100 (Official Build) (64-bit)
Google Chrome 版本 76.0.3809.100(官方版本)(64 位)
C:\WINDOWS\system32>java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
Eclipse IDE for Java Developers Version: 2019-06 (4.12.0)
面向 Java 开发人员的 Eclipse IDE 版本: 2019-06 (4.12.0)
Windows 10
视窗 10
I am tried reinstalling my windows to have a fresh OS, but it still didn't help the situation.
我试图重新安装我的 Windows 以获得一个全新的操作系统,但它仍然没有帮助这种情况。
Code trials:
代码试验:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class One {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\Work\chromedriver_win32\chromedriver.exe");
WebDriver Driver=new ChromeDriver();
Driver.get("http://www.yahoo.com");
}
}
Error:
错误:
Starting ChromeDriver 77.0.3865.10 (bc3579f611bbc73331171afe020ec7a45e6ccc55-refs/branch-heads/3865@{#93}) on port 32932
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 77
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'LAPTOP-P9CFNEOV', ip: '172.20.10.12', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_222'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
Ordinal0 [0x0046EBD3+1502163]
Ordinal0 [0x003EF781+980865]
Ordinal0 [0x0037763F+489023]
Ordinal0 [0x0030F2F4+62196]
Ordinal0 [0x0030BCDA+48346]
Ordinal0 [0x003297E0+169952]
Ordinal0 [0x0032940D+168973]
Ordinal0 [0x003278EB+162027]
Ordinal0 [0x00310AC7+68295]
Ordinal0 [0x00311B40+72512]
Ordinal0 [0x00311AD9+72409]
Ordinal0 [0x00408FE7+1085415]
GetHandleVerifier [0x0050D8AD+503293]
GetHandleVerifier [0x0050D640+502672]
GetHandleVerifier [0x0051471C+531564]
GetHandleVerifier [0x0050E0BA+505354]
Ordinal0 [0x004006B6+1050294]
Ordinal0 [0x0040052F+1049903]
Ordinal0 [0x0040B04B+1093707]
Ordinal0 [0x0040B1B3+1094067]
Ordinal0 [0x0040A145+1089861]
BaseThreadInitThunk [0x75988494+36]
RtlAreBitsSet [0x775641C8+136]
RtlAreBitsSet [0x77564198+88]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandlerStarting ChromeDriver 77.0.3865.10 (bc3579f611bbc73331171afe020ec7a45e6ccc55-refs/branch-heads/3865@{#93}) on port 32932
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 77
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11- 14T08:25:48'
System info: host: 'LAPTOP-P9CFNEOV', ip: '172.20.10.12', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_222'
Driver info: driver.version: ChromeDriver
(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction##代码##(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession##代码##(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at One.main(One.java:10)
回答by DebanjanB
This error message...
这个错误信息...
##代码##...implies that the ChromeDriverwas unable to initiate/spawn a new WebBrowseri.e. Chrome Browsersession.
...暗示ChromeDriver无法启动/生成新的WebBrowser,即Chrome 浏览器会话。
Your main issue is the incompatibilitybetween the version of the binaries you are using as follows:
您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:
- You are using chromedriver=77.0
- Release Notes of chromedriver=77.0clearly mentions the following :
- 您正在使用chromedriver=77.0
- chromedriver=77.0 的发行说明清楚地提到了以下内容:
Supports Chrome version 77
支持Chrome 77 版
- You are using chrome= 76.0
- Release Notes of ChromeDriver v76.0clearly mentions the following :
- 您正在使用chrome= 76.0
- ChromeDriver v76.0 的发行说明清楚地提到了以下内容:
Supports Chrome version 76
支持Chrome 76 版
So there is a clear mismatch between the ChromeDriver v77.0and the Chrome Browser v76.0
所以ChromeDriver v77.0和Chrome 浏览器 v76.0之间存在明显的不匹配
Solution
解决方案
Ensure that:
确保这件事:
- ChromeDriveris updated to current ChromeDriver v76.0level.
- Chromeis updated to current Chrome Version 76.0level. (as per ChromeDriver v76.0 release notes)
- Cleanyour Project Workspacethrough your IDEand Rebuildyour project with required dependencies only.
- If your base Web Clientversion is too old, then uninstall it through Revo Uninstallerand install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Test
as non-rootuser.
- ChromeDriver更新到当前ChromeDriver v76.0级别。
- Chrome已更新到当前Chrome 版本 76.0级别。(根据ChromeDriver v76.0 发行说明)
- 清理你的项目工作,通过你的IDE和重建仅需要依赖你的项目。
- 如果您的基本Web Client版本太旧,请通过Revo Uninstaller卸载它并安装最新的 GA 和发布版本的Web Client。
- 进行系统重启。
@Test
以非 root用户身份执行。
Reference
参考
You can find a relevant detailed discussion in:
您可以在以下位置找到相关的详细讨论:
回答by Jatush Lashkari
You should be download and replace this driver to your chrome driver Chrome Driver
您应该下载此驱动程序并将其替换为您的 chrome 驱动程序Chrome 驱动程序
回答by Hamza Lachi
You need To Download Chrome Driver To this version here is your version link You can click And download: https://chromedriver.storage.googleapis.com/index.html?path=77.0.3865.10/
您需要下载 Chrome 驱动程序到此版本这里是您的版本链接您可以单击并下载:https: //chromedriver.storage.googleapis.com/index.html?path=77.0.3865.10/