如何解决显示"Aw,Snap!"的Chrome浏览器的问题通过ChromeDriver和Selenium通过Python 3执行测试时显示页面 [英] How to address Chrome displaying "Aw, Snap!" page while executing tests through ChromeDriver and Selenium through Python 3

查看:67
本文介绍了如何解决显示"Aw,Snap!"的Chrome浏览器的问题通过ChromeDriver和Selenium通过Python 3执行测试时显示页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行大约一个小时后,我的硒浏览器将显示"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.

您看到此错误大约是基于

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:

此问题最终通过提交/ CreateAnonymousSharedMemory()不会泄漏文件时的"https://chromium.googlesource.com/chromium/src.git/+/fca5d89ce30c4af1f53750de111e774b031f70f5" rel ="nofollow noreferrer">修订返回fd.

This issue was finally addressed through the commit / revision by fixing CreateAnonymousSharedMemory() not to leak FILE when returning fd.

CreateAnonymousSharedMemory()已修改为以文件描述符(而不是文件)的形式返回可写内存句柄.由于POSIX在不关闭基础文件描述符的情况下没有提供拆卸FILE的标准方法,因此这是通过泄漏FILE来实现的.现在,我们提供了 CreateAndOpenFdForTemporaryFileInDir(),从而完全无需将临时文件描述符包装到FILE中.

CreateAnonymousSharedMemory() was modified to return the writable memory handle as a file-descriptor rather than as a FILE. Since POSIX does not provide a standard way to teardown a FILE without also close()ing the underlying file-descriptor, this was achieved by leaking the FILE. We now provide CreateAndOpenFdForTemporaryFileInDir(), to avoid the need to wrap the temporary-file descriptor into a FILE at all.


结论

确保:

  • /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执行测试时显示页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆