Selenium + Java (07): abnormal StaleElementReferenceException solutions

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_36396763/article/details/90694450
StaleElementReferenceException错误

The reason given: page elements load has not been out on the right elements to manipulate them.

Solution: Add the wait.

Thread.sleep(1000);//线程等待1秒钟,让元素加载。(时长可适当设置)

Thread waits for a thread in java class in sleep () method.
The way we must wait until after the closing of the implementation of the code, relatively rigid, generally not recommended.
But in the pop process, the thread may prefer to wait.

It can also be used to determine whether the page elements have been shown, and then the way it operates to be resolved.

Guess you like

Origin blog.csdn.net/qq_36396763/article/details/90694450