You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Electron版本后,启动ChromeDriver测试Electron应用遇SessionNotCreatedException

Electron应用升级后Selenium测试启动失败问题

升级Electron应用版本后,启动Selenium测试时出现以下错误:

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

当前使用的版本信息:

  • Electron版本:4.2.12
  • ChromeDriver版本:2.42(已尝试2.40至2.43版本)
  • Selenium版本:4.0

配置代码如下:

String projectLocation = System.getProperty("user.dir");                
System.setProperty("webdriver.chrome.driver", projectLocation + "/chromedriver.exe");
        
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox"); // Bypass OS security model
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-extensions"); // disabling extensions
options.addArguments("--disable-gpu"); // applicable to windows os only
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--remote-allow-origins=*");
options.setBinary("C:/Users/Public/ElectronApp.exe");
browser = new ChromeDriver(options);
pageConfig = new PageConfig(browser);

内容的提问来源于stack exchange,提问作者FearghalQA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 04:10:03