Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How To Overcome Stale Element Reference Exception in Selenium:

Category: Selenium WebDriver

Solution 1: Refreshing the web page
Solution 2: Using Try Catch Block
Solution 3: Using Explicit Wait
Solution 4: Using PageFactory
We could avoid StaleElementException using POM. In POM, we use initElements() method which loads the element but it won’t initialize elements. initElements() takes latest address. It initializes during run time when we try to perform any action on an element. This process is also known as Lazy Initialization.

Leave a Reply

Your email address will not be published. Required fields are marked *