gpt4 book ai didi

java - Selenium 错误: "org.openqa.selenium.SessionNotCreatedException: session not created from tab crashed" after update electron engine to 9. 0.3

转载 作者:行者123 更新时间:2023-12-01 16:13:25 25 4
gpt4 key购买 nike

我尝试为我们的应用程序进行自动测试。我使用:java+gradle+testNG+selenium+sikulix。适用于 win 10 和 mac os x。我们的应用程序基于电子引擎。之前我们使用Electron 7,还可以,但是更新Electron Engine版本到9.0.3后我的测试失败并出现以下错误:

org.openqa.selenium.SessionNotCreatedException: session not created
from tab crashed

(完整的堆栈跟踪将在下面)

看起来应用程序窗口出现几秒钟后就崩溃了。

我尝试修复它的方法:

  • 将 java 升级到 openJDK 14;

  • 将 gradle 升级到 6.5;

  • 将 Selenium 升级到 4.0.0-alpha-6;

  • 使用不同版本的网络驱动程序。来自谷歌和官方淘宝镜专场;

  • 使用Ccleaner清理现金,重新启动PC,更新环境变量;

  • 添加新参数

     options.addArguments("--no-sandbox");
    options.addArguments("--disable-dev-shm-usage");

来自讨论:unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed with ChromeDriver Selenium

Electron 引擎 9.0.3 包含 Chromium 83.0.4103.99 ( https://www.electronjs.org/releases/stable#9.0.3 )

我从以下位置下载的官方网络驱动程序版本:https://sites.google.com/a/chromium.org/chromedriver/downloads我尝试了 ChromeDriver 83.0.4103.39 中的所有版本。

我从以下位置下载的电子特殊版本:https://npm.taobao.org/mirrors/electron/我尝试了从 9.0.2 开始的所有版本。

我非常感谢帮助。提前致谢。

完整堆栈跟踪:

org.openqa.selenium.SessionNotCreatedException: session not created
from tab crashed
(Session info: chrome=83.0.4103.100)
Build info: version: '4.0.0-alpha-6', revision: '5f43a29cfc'
System info: host: 'Alexeys-MacBook-Pro.local', ip: 'fe80:0:0:0:c21:3e37:9c8:7dd5%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.5', java.version: '14.0.1'
Driver info: driver.version: ChromeDriver
remote stacktrace: 0 chromedriver 0x000000010e881d09 chromedriver + 4816137
1 chromedriver 0x000000010e81c463 chromedriver + 4400227
2 chromedriver 0x000000010e4a7a02 chromedriver + 776706
3 chromedriver 0x000000010e49bc0b chromedriver + 728075
4 chromedriver 0x000000010e49b6c6 chromedriver + 726726
5 chromedriver 0x000000010e49ae23 chromedriver + 724515
6 chromedriver 0x000000010e49a0af chromedriver + 721071
7 chromedriver 0x000000010e49a321 chromedriver + 721697
8 chromedriver 0x000000010e499aa2 chromedriver + 719522
9 chromedriver 0x000000010e4a0daf chromedriver + 748975
10 chromedriver 0x000000010e499a4b chromedriver + 719435
11 chromedriver 0x000000010e49aa09 chromedriver + 723465
12 chromedriver 0x000000010e49a0af chromedriver + 721071
13 chromedriver 0x000000010e49a321 chromedriver + 721697
14 chromedriver 0x000000010e499aa2 chromedriver + 719522
15 chromedriver 0x000000010e49fce8 chromedriver + 744680
16 chromedriver 0x000000010e499a4b chromedriver + 719435
17 chromedriver 0x000000010e49aa09 chromedriver + 723465
18 chromedriver 0x000000010e49a0af chromedriver + 721071
19 chromedriver 0x000000010e49a321 chromedriver + 721697
20 chromedriver 0x000000010e499aa2 chromedriver + 719522
21 chromedriver 0x000000010e49475e chromedriver + 698206
22 chromedriver 0x000000010e499a4b chromedriver + 719435
23 chromedriver 0x000000010e49991d chromedriver + 719133
24 chromedriver 0x000000010e4a9133 chromedriver + 782643
25 chromedriver 0x000000010e4305de chromedriver + 288222
26 chromedriver 0x000000010e42c5e3 chromedriver + 271843
27 chromedriver 0x000000010e40611d chromedriver + 114973
28 chromedriver 0x000000010e4070b5 chromedriver + 118965
29 chromedriver 0x000000010e8442ef chromedriver + 4563695
30 chromedriver 0x000000010e8515ea chromedriver + 4617706
31 chromedriver 0x000000010e851379 chromedriver + 4617081
32 chromedriver 0x000000010e828189 chromedriver + 4448649
33 chromedriver 0x000000010e851b73 chromedriver + 4619123
34 chromedriver 0x000000010e839ef3 chromedriver + 4521715
35 chromedriver 0x000000010e8682c4 chromedriver + 4711108
36 chromedriver 0x000000010e887dc7 chromedriver + 4840903
37 libsystem_pthread.dylib 0x00007fff716d0109 _pthread_start + 148
38 libsystem_pthread.dylib 0x00007fff716cbb8b thread_start + 15


at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$1(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:582)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:136)
at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:75)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
at tests.BaseTests.getWebDriver(BaseTests.java:35)
at tests.BaseTests.userLogin(BaseTests.java:45)
at tests.BaseTests.startMeeting(BaseTests.java:58)
at tests.BaseTests.shareEntireScreen(BaseTests.java:66)
at tests.EntireScreenSharingTests.testsName(EntireScreenSharingTests.java:79)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:597)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.testng.TestRunner.privateRun(TestRunner.java:766)
at org.testng.TestRunner.run(TestRunner.java:587)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1182)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1109)
at org.testng.TestNG.runSuites(TestNG.java:1039)
at org.testng.TestNG.run(TestNG.java:1007)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:110)

这是我的 getWebDriver 方法的一部分

            ChromeOptions options = new ChromeOptions();
options.setBinary(PathsAndVariables.toDvcAppDeep);
// options.addArguments("--no-sandbox");
// options.addArguments("--disable-dev-shm-usage");
System.setProperty("webdriver.chrome.driver", PathsAndVariables.toWebDriver);
driver = new ChromeDriver(options);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

最佳答案

您应该根据您的 chrome 浏览器版本使用正确的 chrome 驱动程序 exe检查您的浏览器版本并从 https://chromedriver.chromium.org/downloads 获取 chrome 驱动程序 exe链接

关于java - Selenium 错误: "org.openqa.selenium.SessionNotCreatedException: session not created from tab crashed" after update electron engine to 9. 0.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62471378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com