electron 电子应用程序在几分之一秒内启动并消失

jxct1oxe  于 2023-02-10  发布在  Electron
关注(0)|答案(1)|浏览(198)

我正在尝试使用 chrome 启动电子应用程序。但是,一旦它得到了几分之一秒内启动它消失了。下面是我的代码。我们如何才能保持应用程序停留在下一个行动。
在我的控制台中也出现了以下异常。我使用的是 chrome 版本:110.0.5481.78和当前chrome浏览器版本:110.0.5481.77
在电子版本中,我没有找到版本110.0.5481.78的 chrome 版本。[https://github.com/electron/electron/releases]

 ChromeOptions options = new ChromeOptions();
  options.setBinary("C://folder//folderpath//executableFilePath.exe");            
  options.setCapability("chromeOptions", options);
 WebDriver weBdriver = new ChromeDriver(options); ```  

Console logs:

   ```  org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 110
        Current browser version is 100.0.4896.143 with binary path C:\Program Files\file\file.exe
        Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
        System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.5'
        Driver info: driver.version: ChromeDriver
        remote stacktrace: Backtrace:
            Cr_z_deflate [0x00007FF6EB3BACE2+123234]
            (No symbol) [0x00007FF6EB316F82]
            (No symbol) [0x00007FF6EB1C772D]
            (No symbol) [0x00007FF6EB1F0840]
            (No symbol) [0x00007FF6EB1EB5F4]
            (No symbol) [0x00007FF6EB1E8F79]
            (No symbol) [0x00007FF6EB2251EA]
            (No symbol) [0x00007FF6EB21D413]
            (No symbol) [0x00007FF6EB1F329E]
            (No symbol) [0x00007FF6EB1F454E]
            GetHandleVerifier [0x00007FF6EB725030+3484560]
            GetHandleVerifier [0x00007FF6EB76197B+3732699]
            GetHandleVerifier [0x00007FF6EB765405+3747685]
            GetHandleVerifier [0x00007FF6EB496EEA+805450]
            (No symbol) [0x00007FF6EB323643]
            (No symbol) [0x00007FF6EB32BC44]
            (No symbol) [0x00007FF6EB32BD74]
            (No symbol) [0x00007FF6EB3385FD]
            BaseThreadInitThunk [0x00007FF9D6A87034+20]
            RtlUserThreadStart [0x00007FF9D7802651+33]
        
            at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
            at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
            at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
            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$0(ProtocolHandshake.java:126)
            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
            at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:1002)
            at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
            at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
            at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
            at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
            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:647)
            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:157)
             ```
omhiaaxx

omhiaaxx1#

现在已经解决了,因为版本不匹配,我已经安装了最新版本的chromium驱动程序,但是我们的电子应用程序支持较低版本的chromium驱动程序[100.0.4896.143],我们可以通过了解开发团队使用的电子包来检查。

相关问题