Home > Backend Development > Python Tutorial > Why Does My Selenium Script Throw a \'session deleted because of page crash\' Error?

Why Does My Selenium Script Throw a \'session deleted because of page crash\' Error?

Mary-Kate Olsen
Release: 2024-12-26 14:12:14
Original
751 people have browsed it

Why Does My Selenium Script Throw a

Session Deletion Error Due to Page Crash

Introduction

ChromeDriver users have encountered an enigmatic error message while utilizing Selenium and Cron tasks. The error manifests as, "unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed". This article investigates the cause of this error and provides possible solutions.

Error Analysis

The pivotal error message is:

selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
Copy after login

Scrutiny of the error message and code snippets reveals a correlation with the issue referred to as "from tab crashed".

Solution

Several solutions have been proposed:

  1. Add --no-sandbox to the Chrome options.
  2. Mount /dev/shm to a larger size or share it with the host using -v /dev/shm:/dev/shm.
  3. Disable dev SHM usage: chrome_options.add_argument('--disable-dev-shm-usage').

Fix for "From Tab Crashed"

The "from tab crashed" issue stemmed from a Linux issue where the system attempted to use /dev/shm for non-executable memory. Fixes have been implemented in subsequent Chrome versions.

Reference

  • [Linux: Chrome/Chromium SIGBUS/Aw, Snap! on small /dev/shm](https://bugs.chromium.org/p/chromium/issues/detail?id=736452)
  • [org.openqa.selenium.SessionNotCreatedException: session not created exception from tab crashed error when executing from Jenkins CI server](https://github.com/SeleniumHQ/selenium/issues/4542)

The above is the detailed content of Why Does My Selenium Script Throw a 'session deleted because of page crash' Error?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template