JavascriptException Stale element not found after (multiple) redirects #2968
victorbmlabs
started this conversation in
General
Replies: 1 comment 6 replies
-
The element is "stale" because it no longer exists in the state that you found it in. (A page reload or removing the element would cause that.) Each time the page refreshes, you must relocate the element before using the variable that you saved it in. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm building a SeleniumBase scraper that takes a set of tasks and performs them on a website. After performing some actions on the site the script calls
driver.execute_script("return window.variable;")
. This works fine on all domains I've scraped even with any redirects after clicks.Today I scraped a new website which includes pressing two buttons that both redirect you to a page (2 redirects total). After the redirects the script runs
execute_script
and throws aselenium.common.exceptions.JavascriptException
.I'm not quite sure why this javascript variable is a stale element. Data is being pushed to it on every page (similar to Google's dataLayer)
Beta Was this translation helpful? Give feedback.
All reactions