展开全部
请参考selenium.webdriver.support.select的API.
select_by_visible_text(text)[source]
Select all options that display text matching the argument. That is, when given “Bar” this would select an option like:
Bar
Args :
value - The value to match againstselect_by_value(value)[source]
Select all options that have a value matching the argument. That is, when given “foo” this would select an option like:
Bar
Args :
index - The option at this index will be selectedselect_by_index(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 :
options
Returns a list of all options belonging to this select tag
first_selected_option
The first selected option in this select tag (or the currently selected option in a normal select)
完整的API见e5a48de588b662616964757a686964616f31333339663963http://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.select.html#selenium.webdriver.support.select.Select.deselect_by_value