Explanation of selenium’s efficient response to web page element refresh

When we do selenium on the page Type () or selenium When clicking (), we often need to wait for an element to appear. For general web pages, when we enter a new page, we often use selenium waitForPageToLoad(WAITTIME);

For the elements in the pop-up window, how many seconds will it take to write them? In fact, you can use the following more general and efficient method to write a waitforelement() method yourself:

Java code

The function of this code is to let us wait for an element for 60 seconds at most until it appears, otherwise the test case will fail. When we want to click or type an element, we will call this method first. The following is the improved click method

Java code

From then on, no matter whether the page is implemented by Ajax or not, we don't need thread in the program as long as we call such a click () method Sleep (10000) code.

The above example explanation of selenium's efficient response to web page element refresh is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>