问题描述
运行大约一个小时后,我的硒浏览器将显示"Aw,Snap!".页面,并且无法从控制台以任何方式与浏览器进行交互,因此必须关闭浏览器并重新启动脚本.
After about an hour of running my selenium browser will display an "Aw, Snap!" page, and I am unable to interact with the browser in any way from the console, and I have to close browser and re-start my script.
对此有解释还是简单的解决方法?
Is there an explanation or easy fix for this?
推荐答案
此错误屏幕...
...表示 ChromeDriver 在加载新的浏览上下文时遇到问题,即 Chrome浏览器会话.
...implies that the ChromeDriver is having problems loading a new Browsing Context i.e. the Chrome Browser session.
您看到此错误大约是基于测试,由于 /dev/shm
(即/dev/shm
空间用完了.例如:
You are seeing this error about an hour of running Chrome Browser based Selenium tests and this issue can occur due to reduced size of /dev/shm
i.e. /dev/shm
running out of space. As an example:
mount -o remount,size=64M /dev/shm
理想情况下应该是:
mount --bind /tmp/ /dev/shm/
在Docker环境中运行Chromium时, 64M
的大小几乎处于缩减状态.
While running Chromium in Docker environment 64M
size is pretty much reduced state.
根据>问题522853:Linux:Chrome/Chromium中的讨论SIGBUS/Aw,快点!在小型/dev/shm 上:
-
util_posix.cc:GetShmemTempDir
尝试始终对不可执行的内存使用/dev/shm
. -
/dev/shm
所需的大小很大程度上取决于渲染器的数量,屏幕分辨率等. - 有时大型Web应用程序可能会耗尽内存,甚至在
中空间不足之前/dev/shm
- 有时,某些Docker容器默认会严格限制其共享内存的大小,这对于某些工作负载而言可能是可以的,并且可能阻止任何容器占用所有内存.
util_posix.cc:GetShmemTempDir
on Linux attempts to always use/dev/shm
for non-executable memory.- The required size of
/dev/shm
by large depends on the number of renderers, screen resolution, etc. - At time you may run out of memory due to large webapps even before running out of space in
/dev/shm
- At times some Docker containers decides to severely limit the size of their shared memory by default, which may be ok for some workloads, and probably prevents any container from hogging all the memory.
此问题在以下讨论中进行了详细分析和讨论:
This issue was analyzed and discussed at length in the following discussions:
此问题最终通过提交/返回fd.
This issue was finally addressed through the commit / revision by fixing CreateAnonymousSharedMemory()
not to leak FILE when returning fd.
结论
确保:
-
/dev/shm/
已安装有足够的内存. - 硒已升级到当前级别版本3.141.59 .
- ChromeDriver 已更新为当前的ChromeDriver v79.0.3945.36 级别.
- Chrome 已更新为当前的 Chrome版本79.0 级别.(根据 ChromeDriver v78.0发行说明) 通过 IDE
- 清理您的项目工作区和重建您的项目,并且仅具有必需的依赖项.
- 如果您的基本 Web客户端版本太旧,请通过来卸载. Revo Uninstaller 并安装最新版本的 Web客户端 GA和发行版.
- 进行系统重启.
- 以非root用户用户的身份执行
@Test
.
/dev/shm/
is mounted with enough memory.- Selenium is upgraded to current levels Version 3.141.59.
- ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
- Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v78.0 release notes)
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Test
as non-root user.
这篇关于如何解决显示"Aw,Snap!"的Chrome浏览器的问题通过ChromeDriver和Selenium通过Python 3执行测试时显示页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!