Python Webdriver API Learning notes

Source: Internet
Author: User

    • Browser actions
      • Driver.maximize_window () #浏览器最大化
      • Driver.set_window_size (480,800) #设置浏览器宽, high
      • Driver.back () & Driver.forward () #后退, Advance
    • Positioning
      • FIND_ELEMENT_BY_ID ()
      • Find_element_by_name ()
      • Find_element_by_class_name ()
      • Find_element_by_tag_name ()
      • Find_element_by_link_text ()
      • Find_element_by_partial_link_text ()
      • Find_element_by_xpath ()
      • Find_element_by_css_selector ()

    • Manipulating Test objects
      • Clear ()
      • Send_keys ()
      • Click ()
      • Submit () #提交表单
    • Common methods of Webelement interface
      • driver.find_element_by_id ("kw"). Size #返回元素的尺寸
      • driver.find_element_by_id ("kw"). Text #返回元素的文本
      • driver.find_element_by_id ("kw"). Get_attribute (' type ') #获取元素属性值
      • result=driver.find_element_by_id ("kw"). Is_displayed () #元素是否可见
      Mouse events (Actionchains)
      • Context_click () #右击
      • Double_click ()
      • Drag_and_drop ()
      • Move_to_element () #鼠标悬停在一个元素之上
      • Click_and_hold () #按下鼠标左键在一个元素之上

Instance:

From Selenium.webdriver.common.action_chains import Actionchains

Right=drvier.find_element_by_xpath ("xxx")

Actionchains (Driver). Context_click (right). Perform ()

    • Keyboard events
      • Send_keys (Keys.back_space)
      • Send_keys (Keys.space)
      • Send_keys (Keys.tab
      • Send_keys (Keys.escape) #回退键ESC
      • Send_keys (Keys.enter)
      • Send_keys (Keys.control, ' a ')
      • Send_keys (Keys.control, ' C ')
      • Send_keys (Keys.control, ' x ')
      • Send_keys (Keys.control, ' V ')

From Selenium.webdriver.common.keys import keys

    • Printing information
      • Driver.title
      • Driver.current_url
      • driver.find_element_by_id ("xxx"). Text

Python Webdriver API Learning notes

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.