org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist

org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist

我尝试在作为节点连接到 selenium 的远程 PC 上启动电子应用程序 grid.previously 它工作正常 fine.But 现在我收到此错误 "DevToolActivePort file doesn't exist"

    System.out.println("launch application in windows PC");     
    capa  = new DesiredCapabilities();

    capa.setBrowserName("chrome");
    File file = new File("path\to\file\.exe"); 
    URL server = new URL("http://ip_of_remote_pc:4444/wd/hub"); 

    ChromeOptions options = new ChromeOptions();
    options.setBinary(file);   //Sets the path to the Chrome executable
    capa.setCapability(ChromeOptions.CAPABILITY, options);
    driver2 = new RemoteWebDriver(server, capa); //launch the application
    System.out.println("launching application in remote PC");
    driver2.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);   
    System.out.println("Application launched"); 

只需添加以下 ChromeOptions 即可解决问题,

ChromeOptions options = new ChromeOptions();
options.addArgument("--headless");
options.addArgument("--no-sandbox");  // Bypass OS security model
options.addArguments("--disable-gpu"); // applicable to windows os only

下载 Chrome electron 驱动程序,或访问此 https://github.com/electron/electron/releases 在这里安装 chromedriver 就可以了