0


解决Selenium在运行中出现浏览器页面崩溃,最后导致丢失session id的问题。

There are diverse solution to this issue. However as per UnknownError: session deleted because of page crash from tab crashed this issue can be solved by either of the following solutions:

  • Add the following chrome_options:
chrome_options.add_argument('--no-sandbox')         
  • Chrome seem to crash in Docker containers on certain pages due to too small /dev/shm. So you may have to fix the small /dev/shm size.
  • An example:
  • sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
  • It also works if you use -v /dev/shm:/dev/shm option to share host/dev/shm
  • Another way to make it work would be to add the chrome_options as --disable-dev-shm-usage. This will force Chrome to use the /tmp directory instead. This may slow down the execution though since disk will be used instead of memory.
  • chrome_options.add_argument('--disable-dev-shm-usage')

本文转载自: https://blog.csdn.net/qq_33385691/article/details/128075527
版权归原作者 莺声门径 所有, 如有侵权,请联系我们删除。

“解决Selenium在运行中出现浏览器页面崩溃,最后导致丢失session id的问题。”的评论:

还没有评论