Page Factory: StaleElementReference Exception

0 votes
I'm learning PageFactory and I understood the concept of initElements() from where the elements are located. Now, if I click on an element and if that results in other elements in DOM changing, then it might throw a StaleElementReferenceException. How will we solve this issue?
Do I have to find that element once again by expecting there to be a change in the Element's properties in the DOM? Or is there another way out?
Apr 20, 2018 in Selenium by kappa3010
• 2,010 points
11 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Usually, a StaleElementReferenceException is thrown when:
1. The element has been deleted entirely or
2. The element is no longer attached to the DOM

So by clicking on an element, if there is a change in DOM structure, then you have to simply re-initialize ( using initElements() ) all the elements for further use.
answered Apr 20, 2018 by king_kenny
• 3,590 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Need to wait until page is completely loaded - Selenium WebDriver

Using Thread.Sleep(); is one approach; but its ...READ MORE

answered Apr 2, 2018 in Selenium by nsv999
• 5,030 points
2,305 views
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,030 points
4,287 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Page Object Pattern in Selenium WebDriver

Check below links: Documentation: Page Objects and PageFactory  Page Object Design Pattern  Other ...READ MORE

answered Apr 17, 2018 in Selenium by Vardy
• 2,280 points
143 views
0 votes
1 answer

30 min Wait on a page and then perform any Operation using Selenium Webdriver

Implicit wait tells webdriver to poll the ...READ MORE

answered Apr 19, 2018 in Selenium by Shubham
• 12,030 points
67 views
0 votes
2 answers

Selenium: Diff between POM (page object model) and page factory?

Hi, In POM (Page Object Model) you create ...READ MORE

answered Mar 14 in Selenium by Ellen Dares
1,710 views
0 votes
2 answers

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.