power_settings_new

Driver refresh. staleelementexception

by
asked
0 votes
93 views
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();?

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.

1 Answer

answered by
0 votes
 
Best answer

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();

 

Related questions

add
...