Skip to Main Content
Mastering Selenium WebDriver 3.0 - Second Edition
book

Mastering Selenium WebDriver 3.0 - Second Edition

by Mark Collin
June 2018
Beginner to intermediate content levelBeginner to intermediate
376 pages
8h 58m
English
Packt Publishing
Content preview from Mastering Selenium WebDriver 3.0 - Second Edition

StaleElementReferenceException

This is an exception that you will quite often see if you work with AJAX or JavaScript-heavy websites where the DOM is continuously being manipulated.

You are probably used to seeing code like this:

WebElement googleSearchBar = driver.findElement(By.name("q")); 

The WebElement object that you have created is actually a reference to a specific element in the DOM; think of it as a phone number that you call to talk to that element:

When the DOM is manipulated and the old element is destroyed, that reference no longer links to an element in the DOM and it becomes stale. Using our phone number analogy, this is where ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Selenium WebDriver 3 Practical Guide - Second Edition

Selenium WebDriver 3 Practical Guide - Second Edition

Pallavi Sharma, UNMESH GUNDECHA, Satya Avasarala

Publisher Resources

ISBN: 9781788299671Supplemental Content