zoukankan      html  css  js  c++  java
  • selenium之节点交互API

    查找元素

    clear()——如果是文本输入框,就清除文本。

    click()——单击

    get_attribute(name)——获取元素的属性值

    get_property(name)——获取元素的给定属性值

    is_displayed()——元素对用户是否可见

    is_enabled()——是否启用元素

    is_selected()——是否选择了复选框或者单选框

    screenshot(filename)——将当前元素的屏幕截图保存到png文件中

      示例:element.screenshot('/ Screenshots / foo.png')

    send_keys("值")——文字输入

    submit()——提交表格

    value_of_css_property(属性名)——获取css属性的值

    text——元素的文本

    tag_name——当前元素的标签名

    size——元素的大小

    location——元素在当前可渲染画布的位置

    location_once_scrolled_into_view——用来找到元素在屏幕上的位置。(位置是屏幕左上角的位置,返回None表示不可见)

    screenshot_as_base64——以base64编码字符串的形式获取当前元素的屏幕快照

      示例:img_b64 = element.screenshot_as_base64

    screenshot_as_png——二进制数据获取当前元素的屏幕截图

    parent——(官网原文)Internal reference to the WebDriver instance this element was found from

    rect——(官网原文)A dictionary with the size and location of the element

    详见官方文档

  • 相关阅读:
    HZNU Personal Training 2
    6月30日-助教题解-刺客信条起源
    Educational Codeforces Round 90 (Rated for Div. 2)
    暑假python学习笔记
    HZNU Training 32 for Zhejiang Provincial Competition 2020
    哈夫曼树
    网络流24题
    splay
    生成树计数
    HZNU Training 29 for Zhejiang Provincial Competition 2020
  • 原文地址:https://www.cnblogs.com/codexlx/p/12580218.html
Copyright © 2011-2022 走看看