Java + Selenium Timeout Interface usage Introduction

Source: Internet
Author: User
Tags set time

The previous article describes how to start a browser. This article introduces the interface method for wait time in the previous code, the code is as follows:

Driver.manage (). Timeouts (). Pageloadtimeout (5, timeunit.seconds);  



The timeout interface has the following three commonly used interfaces.

Implicitlywait (): Implicit time Waits is the time to find the element, set a maximum time value, if the first time driver did not find the page element, then continue to find, until the maximum time value of the setting is consumed, or not found, then throw the exception that did not find the element. If the element is found within the set time range, then the next line of code is executed, and no time is required, which is the meaning of the implicit wait. So, implicit time waits for a common combination of finding page elements together.

Setscripttimeout (), the function is to wait for the execution of an asynchronous script to end, rather than throw an error inside, within the specified time set. This may be used when executing JavaScript scripts.

pageloadtimeout (), the literal meaning of the page load timeout, the role is to set a specified time, waiting for the full loading of the Web page, rather than the inside throw error. We know that if the network speed is slow, or too many page elements, such as a large area of Web page rendering, will certainly cause the page to load slowly. The purpose of this interface is to deal with this kind of problem.

The above is about the wait Time interface method Introduction, Next, I will introduce about the Windows interface.

Java + Selenium Timeout Interface usage Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.