Blo*_*ten 7 c# selenium google-chrome selenium-chromedriver selenium-webdriver
我开始研究 Selenium (C#),令我惊讶的是,我什至无法运行Selenium Docs中最简单的项目。然而,我的同事开箱后就可以正常运行,没有任何问题。
我能够运行的唯一方法是将--no-sandbox
选项添加到 Chrome 选项中。Firefox (Gekco) 驱动程序没有这个问题,并且我的 Chrome 版本和我的 Chromedriver 版本匹配。但我不能对每个项目都这样做,因为我们使用的库不通过此选项,并且它超出了我的控制范围。
我可能需要更改哪些策略/配置?
我试图在 S/O 上找到其他类似的线程,但没有一个能解决我的问题。大多数问题可以通过更新 Chrome/ChromeDriver 版本来解决,但我的是最新的 100(Chrome 99 也有同样的问题)。
它只是停留在data:,
并且不会继续到任何其他页面。
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 61538
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
DevTools listening on ws://127.0.0.1:61542/devtools/browser/38c3268c-dd43-4100-bb1a-71aa2af4c1fc
Unhandled exception. OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:61538/session timed out after 60 seconds.
---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
Run Code Online (Sandbox Code Playgroud)
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 61538
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
DevTools listening on ws://127.0.0.1:61542/devtools/browser/38c3268c-dd43-4100-bb1a-71aa2af4c1fc
Unhandled exception. OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:61538/session timed out after 60 seconds.
---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
Run Code Online (Sandbox Code Playgroud)
沙箱是一个 C++ 库,允许创建在严格限制的环境中执行的沙箱进程 \xe2\x80\x94 进程。沙盒进程唯一可以自由使用的资源是 CPU 周期和内存。例如,沙箱进程无法写入磁盘或显示自己的窗口。他们到底能做什么是由明确的政策控制的。Chromium 渲染器是沙盒进程。
\n功能沙箱限制了沙箱内运行的代码中的错误的严重性。此类错误无法在 user\xe2\x80\x98s 帐户中安装持久性恶意软件(因为写入文件系统被禁止)。此类错误也无法从 user\xe2\x80\x99s 计算机读取和窃取任意文件。
\n(在 Chromium 中,渲染器进程被沙箱化并具有这种保护。在删除 NPAPI 后,所有剩余的插件也被沙箱化。Chromium 渲染器进程与系统隔离,但尚未与 Web 隔离。因此,基于域的数据隔离是尚未提供。
\nChrome 在启动期间崩溃的一个常见原因是在 Linux 上以root
用户 ( administrator
) 身份运行 Chrome。虽然可以通过--no-sandbox
在创建 WebDriver 会话时传递标志来解决此问题,但此类配置不受支持且强烈建议不要这样做。您需要将环境配置为以普通用户身份运行 Chrome。
您可以在以下位置找到相关的详细讨论:
\n\n 归档时间: |
|
查看次数: |
33542 次 |
最近记录: |