public class Selenium_timeout
{
Timeout and wait, implicitlywait, object recognition timeout, pageloadtimeout. Page load Timeout
Static Webdriver driver=new firefoxdriver ();
public static void Main (string[] args) throws Exception
{
Global settings, setting timeout for recognition of each object in code
Driver.manage (). Timeouts (). implicitlywait (Timeunit.seconds);
Global settings, setting timeout for loading per page in code
Driver.manage (). Timeouts (). Pageloadtimeout (Timeunit.seconds);
Driver.get ("http://www.baidu.com/");//Open Baidu Home page timeout of 30 seconds
Driver.findelement (By.id ("kw")). SendKeys ("Selenium"); Home page Baidu search box timeout time is 30 seconds
Driver.findelement (By.id ("su")). Click ()//Identify Baidu button timeout of 30 seconds
Selenium_timeout.opensetlink ();
}
public static void Opensetlink () throws Exception
{
Call the Waitfortime method if the recognition timeout is only for a single object
Selenium_timeout.waitfortime (By.linktext ("Settings"));
Driver.findelement (By.linktext ("Settings")). Click ();
}
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.