相关疑难解决方法(0)

org.openqa.selenium.WebDriverException:未知错误:尝试启动Chrome浏览器时,DevToolsActivePort文件不存在

我正在尝试使用URL启动chrome,浏览器启动,之后它什么都不做.

我在1分钟后看到以下错误:

Unable to open browser with url: 'https://www.google.com' (Root cause: org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)
Run Code Online (Sandbox Code Playgroud)

我的配置:

Chrome:66 ChromeBrowser:2.39.56

PS在Firefox中一切正常

selenium google-chrome webdriver selenium-chromedriver selenium-webdriver

120
推荐指数
16
解决办法
11万
查看次数

多线程:chromedriver 不会在第二个窗口中打开 url

线程函数中的Java代码:

    System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--no-sandbox");
    chromeOptions.addArguments("--user-data-dir="+config.chromeUserDir);
    chromeOptions.addArguments("--profile-directory="+profile);
    chromeOptions.addArguments("--start-maximized");
    WebDriver driver = new ChromeDriver(chromeOptions);
    driver.get("https://www.google.com");
Run Code Online (Sandbox Code Playgroud)

并使用以下代码创建对象并在线程中启动

    Driver d1 = new Driver(profile);
    d1.start();

    Driver d2 = new Driver(profile1);
    d1.start();
Run Code Online (Sandbox Code Playgroud)

已经创建了两个不同的配置文件,代码在单线程下运行良好,但在多线程下它不会在两个单独的窗口中打开谷歌网站。它说,

Starting ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac) on port 25692
Only local connections are allowed.
Starting ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac) on port 25954
Only local connections are allowed.
Oct 14, 2018 2:10:46 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Oct 14, 2018 2:10:46 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Created new …
Run Code Online (Sandbox Code Playgroud)

selenium multithreading google-chrome selenium-chromedriver

1
推荐指数
1
解决办法
3200
查看次数