相关疑难解决方法(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时如何修复“[严重]:绑定()失败:无法分配请求的地址(99)”

我在 Centos 7 平台下载了最新版本的 chromedriver:https : //chromedriver.storage.googleapis.com/index.html?path = 74.0.3729.6 /我启动 chromedriver 并收到此错误。

错误 :

Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1556179366.141][SEVERE]: bind() failed: Cannot assign requested address (99)
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

在此处输入图片说明

linux selenium-chromedriver

32
推荐指数
4
解决办法
3万
查看次数

WebDriverException:消息:未知错误:Chrome 无法启动:在 Amazon Linux 上通过 Selenium Python 使用 ChromeDriver Chrome 发生崩溃错误

python linux selenium google-chrome selenium-chromedriver

7
推荐指数
1
解决办法
2万
查看次数

未知错误:DevToolsActivePort 文件不存在

我正在运行 selenium 脚本并继续出现上述错误。这是代码:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class WhatsappTest {

    public static void main(String[] args) {

        System.setProperty("webdriver.chrome.driver", "C:\\Users\\PC-Name\\Documents\\selenium jars\\chromedriver_win32\\chromedriver.exe");

        ChromeOptions options = new ChromeOptions();
        options.addArguments("user-data-dir=C:\\Users\\PC-Name\\AppData\\Local\\Google\\Chrome\\User Data");
//      options.addArguments("--no-sandbox");
//        options.addArguments("--disable-dev-shm-usage");

        WebDriver driver = new ChromeDriver(options);

        //Puts an Implicit wait, Will wait for 10 seconds before throwing exception
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        //Maximize the browser
        driver.manage().window().maximize();
        //Launch website
        driver.navigate().to("https://www.facebook.com/");
        System.out.println(driver.getTitle());

        driver.close();
    }

}
Run Code Online (Sandbox Code Playgroud)

所以代码中的注释行对我不起作用。添加此行时,我总是收到此错误:

options.addArguments("user-data-dir=C:\\Users\\Manish\\AppData\\Local\\Google\\Chrome\\User Data");
Run Code Online (Sandbox Code Playgroud)

和代码工作正常而不添加上面的行。

这是有关错误的更多信息:

(unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-chromedriver

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

WebDriverException:Chrome无法启动:异常退出(未知错误:DevToolsActivePort文件不存在)

尽管版本正确并且安装了 UI,但使用 Selenium 的 Python 脚本无法创建 Chrome 实例。

我已经在这里查看了类似的线程,但似乎都没有解决问题。该代码在 Windows 上运行 - 一旦我尝试在 Linux 上执行它,它就不再运行。我的预期目标是让它以可视方式打开 Chrome,因此我并不是在寻找涉及虚拟显示的解决方案。

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--no-sandbox')

driver = webdriver.Chrome('/home/ethan/chromedriver', chrome_options=options)
driver.set_window_size(1024, 600)
driver.maximize_window()
Run Code Online (Sandbox Code Playgroud)

我安装了 Google Chrome 75.0.3770.100 我还安装了 ChromeDriver 75.0.3770.90

这是代码的完整回溯:

File "cm_update_01.py", line 114, in <module>
    if __name__ == "__main__": main()
  File "cm_update_01.py", line 24, in main
    with open(fetch_file()) as f:
  File "cm_update_01.py", line 75, in fetch_file
    driver = webdriver.Chrome('/home/ethan/chromedriver', chrome_options=options)
  File "/home/ethan/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in …
Run Code Online (Sandbox Code Playgroud)

python selenium python-3.x selenium-chromedriver selenium-webdriver

5
推荐指数
1
解决办法
2万
查看次数

selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话:ChromeDriver Chrome Selenium 没有匹配功能错误

首先,机器和包装规格:我正在运行:

ChromeDriver version 75.0.3770.140
Selenium: version '3.141.0'
WSL (linux subsystem) of windows 10
Run Code Online (Sandbox Code Playgroud)

我正在尝试通过 Selenium 运行 chrome 浏览器。我发现:这些命令,通过谷歌浏览器使用硒。

我有一个测试目录,其中仅包含 chromedriver 二进制文件和脚本。目录位置为:/home/kela/test_dir/

我运行了代码:

import selenium
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


options = Options()
options.binary_location='/home/kela/test_dir/chromedriver'
driver = webdriver.Chrome(chrome_options = options,executable_path='/home/kela/test_dir/chromedriver')
Run Code Online (Sandbox Code Playgroud)

该代码的输出是:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities found
Run Code Online (Sandbox Code Playgroud)

谁能解释为什么当同一个脚本适用于其他没有功能的脚本时我需要功能?我确实尝试添加:

chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
Run Code Online (Sandbox Code Playgroud)

但我得到了同样的错误。所以我不确定我需要添加哪些功能(考虑到它对没有它的其他人也适用?)

编辑 1:解决 DebanjanB 的以下评论:

  1. Chromedriver 位于预期位置。我使用的是 Windows 10。从这里开始,预期位置是 C:\Program …

selenium google-chrome webdriver selenium-chromedriver selenium-webdriver

5
推荐指数
1
解决办法
4万
查看次数

无法在 docker 容器 Apple M1 芯片上使用 selenium_chrome_headless

我正在开发 Apple M1 Pro,并遇到了 Docker 和 chromedriver 的几个问题。

\n

所以我想在我的 Docker 容器上使用 selenium chrome headless 运行 RSpec 测试。我的Dockerfile是:

\n
# Start from the official ruby image, then update and install JS & DB\nFROM --platform=linux/amd64 ruby:2.6.6\nRUN apt-get update -qq && apt-get install -y nodejs postgresql-client\n\n# Install Chromedriver\nRUN apt-get update && apt-get install -y unzip && \\\n    CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \\\n    wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/ && \\\n    unzip ~/chromedriver_linux64.zip -d ~/ && \\\n    rm ~/chromedriver_linux64.zip && \\\n    chown …
Run Code Online (Sandbox Code Playgroud)

selenium ruby-on-rails capybara rspec-rails docker

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

Chrome 驱动程序在 Laravel Dusk 中失败 - “无法打开流:HTTP 请求失败!404 未找到”

在最后一天左右,我开始看到我的 Laravel Dusk 测试在我的 CI/CD 环境中失败(GitHub Actions)。

突然,运行一直运行良好的命令:

php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
Run Code Online (Sandbox Code Playgroud)

..失败并出现错误:

file_get_contents(https://chromedriver.storage.googleapis.com/LATEST_RELEASE_116):无法打开流:HTTP请求失败!HTTP/1.1 404 未找到

尝试通过强制版本 114 来解决此问题:

php artisan install:chrome-driver 114
Run Code Online (Sandbox Code Playgroud)

...失败并出现错误:

Facebook\WebDriver\Exception\SessionNotCreatedException:会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 114

我该如何解决这个问题并让我的测试再次开始通过?

php laravel selenium-webdriver laravel-dusk

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

Selenium可以在服务器上运行以自动执行任务,还是需要浏览器来运行其中的任务

我正在阅读Selenium文档,我无法确定您是否可以在服务器上运行它 - 作为更大的Web应用程序的一部分.

即.Web应用程序中发生的事情会触发自动运行的Selenium脚本,然后将结果返回给Web应用程序.

这可能是Selenium的使用还是总是需要一个实际的浏览器来运行其中的任务,还是可以为自己运行虚拟浏览器?


selenium selenium-webdriver

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