InterviewSolution
Saved Bookmarks
| 1. |
A fresher in your team encounters a ‘StaleElement’ exception while executing an automated test suite. How will you help them solve this issue? |
|
Answer» There are two causes for this exception. Element in the web page that was a part of the current instance has been refreshed or navigated to another web page. This causes the element to be destroyed or reconstructed. The second reason is that the element is no longer attached to the DOM. These are the breakthroughs that I will provide my team members with to solve this issue:
driver.findElement (By.xpath(“sample”)).click();
{ try { driver.findElement(By.xpath("sample")).click(); break; } Catch (Exception e){ Sysout(e.getMessage()); } }
|
|