Python+selenium+eclipse performing web automation (v) Special controls--progress bar

Source: Internet
Author: User

As shown, a progress bar control may appear on some Web pages, and the control's structure code is first clarified when it is processed, such as:

The control here consists of three parts: a progress bar, a slider, and an input box. The input box has been introduced before, no longer tells

The progress bar can get the current value through the Title property

Specific operation can be achieved through the actionchains in the Move_by_offset to achieve the movement of the slider, the specific code is as follows

From selenium.webdriver.common.action_chains import Actionchains #导入ActionChains模块

Browser = Webdriver. Firefox ()

Browser.get (URL) #url为目标WEB的链接

brightnessline=browser.find_element_by_id ("Sliderbrightness_line") #通过ID定位到进度条

Brightnessline.get_attribute ("title") #通过title属性获取当前的值

brightnessslider=browser.find_element_by_id ("Sliderbrightness_thumb") #通过ID定位到滑动块

Actionchains (browser). Click_and_hold (Brightnessslider). Move_by_offset ( -6,7). Release (). Perform () #通过move_by_ Offset () Move slider, 6 means move left 6 pixels in the horizontal direction, 7 means move upward 7 pixels vertically

Python+selenium+eclipse performing web automation (v) Special controls--progress bar

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.