Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
Driver refresh. staleelementexception

Solved 1 Answers 89 Views Selenium
0 1
when you do a refresh of the web page our driver will no longer be having the element in the cache
in order to update our driver as well what do we need to do?
something to do with getWindowhandle();?

1 Answer

0
Best answer
0

reassign webelement.

e.g.

If you are doing

WebElement textbox = driver.findElement(By.tagName("textbox"));

driver.refresh();

textbox.sendKeys();

you will see above exception.

 

To avoid it do:

WebElement textbox = driver.findElement(By.tagName("textbox"));

driver.refresh();

textbox = driver.findElement(By.tagName("textbox"));

textbox.sendKeys();

 
answered by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...