• selenium Select用法笔记


    • select_by value:参数为option中的value属性,例如:HTML代码中 <ignore_js_op> ,应该是value="volvo"这个值,所以应该为小写;
    • select_by_visible_text:参数为option的text值, <ignore_js_op> ,应该是红线标出部分的值,所以应该是大写;
    • Select(driver.find_element_by_name("isImportant")).select_by_visible_text(u"是")

    • deselect_all(self)

    | Clear all selected entries. This is only valid when the SELECT supports multiple selections.
    | throws NotImplementedError If the SELECT does not support multiple selections

    • select_by_index(self, index)

    | Select the option at the given index. This is done by examing the "index" attribute of an
    | element, and not merely by counting.
    |
    | :Args:
    | - index - The option at this index will be selected
    |
    | throws NoSuchElementException If there is no option with specisied index in SELECT

    •  select_by_value(self, value)

    | Select all options that have a value matching the argument. That is, when given "foo" this
    | would select an option like:
    |
    | <option value="foo">Bar</option>
    |
    | :Args:
    | - value - The value to match against
    |
    | throws NoSuchElementException If there is no option with specisied value in SELECT
    |

    •  select_by_visible_text(self, text)

    | Select all options that display text matching the argument. That is, when given "Bar" this
    | would select an option like:
    |
    | <option value="foo">Bar</option>
    |
    | :Args:
    | - text - The visible text to match against
    |
    | throws NoSuchElementException If there is no option with specisied text in SELECT

  • 相关阅读:
    重写移动端滚动条[iScroll.js核心代码]
    利用canvas将网页元素生成图片并保存在本地
    微信小程序的拖拽、缩放和旋转手势
    设计模式之访问者(visitor)模式
    设计模式之原型(prototype)模式
    设计模式之享元(flyweight)模式
    设计模式之职责链模式
    设计模式之组合(compose)模式
    leetcode16
    校招真题练习013 找零(头条)
  • 原文地址:https://www.cnblogs.com/breakcircle/p/6282488.html
Copyright © 2020-2023  润新知