Selenium python explicit and implicit wait methods

Source: Internet
Author: User
Tags selenium python

1 #-*-coding:utf-8-*-2  fromSeleniumImportWebdriver3  fromSelenium.webdriver.common.action_chainsImportActionchains4  fromSelenium.webdriver.support.uiImportwebdriverwait5 6 Import Time7 8Driver = Webdriver. Firefox (executable_path='/users/huiliang/downloads/geckodriver')9Driver.get ("http://www.baidu.com/")Ten  OneWebdriverwait (Driver). Until (LambdaX:X.FIND_ELEMENT_BY_ID ('kw'). Send_keys ("Lambda") A " " - driver returns an instance of the browser - Ten Timeout Timeout the poll_frequency loop to query the gap time, the default is 0.5 seconds, can be omitted - lambda function in short, I need a function now, but I don't want to bother naming a function, which is an anonymous function . - The x inside the lambda, which is the input parameter, refers to the driver, and the return value after the colon -  + adding too much sleep can affect the speed of script execution - so both the display and the implicit are good choices. + " " A  at  -Time.sleep (5) -Driver.quit ()

Selenium python explicit and implicit wait methods

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.