来源:python+selenium select下拉选择框定位处理方法_python_脚本之家
from selenium.webdriver.support.select import Select
s = Select(WebElement 元素)
s.select_by_value(option 中的 value 值)
s.select_by_index(选项序号)
s.select_by_visible_text(option 中的文本)
s.deselect_by_index(选项序号)
s.deselect_by_value(option 中的 value 值)
s.deselect_by_visible_text(option 中的文本)
s.deselect_all()
s.options # 选项列表,每一个元素是一个 WebElement 元素
s.all_selected_options # 选中的选项列表,每一个元素是一个 WebElement 元素
s.first_selected_option # 第一个被选中的选项,也是下拉框的默认值