【问题标题】:org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't existorg.openqa.selenium.WebDriverException:未知错误:DevToolsActivePort 文件不存在
【发布时间】:2018-06-26 04:31:04
【问题描述】:

我正在尝试在作为节点连接到硒网格的远程 PC 上启动电子应用程序。以前它工作正常。但现在我收到此错误“DevToolActivePort 文件不存在”

    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"); 

【问题讨论】:

标签: java selenium-webdriver selenium-chromedriver remotewebdriver


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    只需添加以下 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-05-15
      • 1970-01-01
      • 2022-09-30
      • 1970-01-01
      • 2020-05-03
      • 2019-07-12
      • 2019-08-01
      相关资源
      最近更新 更多