zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    新购服务器流程
    nginx代理证书使用方法
    一键部署lnmp脚本
    mysql主从库配置读写分离以及备份
    Linux入门教程(更新完毕)
    Git 工作流程
    Git远程操作
    常用Git命令
    js数组去重
    Sublime Text设置快捷键让html文件在浏览器打开
  • 原文地址:https://www.cnblogs.com/breakcircle/p/6282488.html
Copyright © 2011-2022 走看看