selenium--select 下拉列表操作

一、selenium 操作类

  selenium里的select 类常用于处理select 元素

二、方法

  下拉列表值常用3个选择方法:
    select_by_value   value 属性
    select_by_index        下标
    select_by_visible_text  文本
三、步骤
0.先找到select 元素
    select_s = driver.find_element_by_tag_name("select")
1.实例化select 类
    s = Select(select_s)
3.1通过value 选择
    s.select_by_value("hanshua")
3.2   通过文本内容
    s.select_by_index(0)
3.3 通过文本
    s.select_by_visible_text("开始")

posted @ 2021-02-17 11:08  胖虎大人v  阅读(130)  评论(0)    收藏  举报