python+selenium自动化测试定位下拉菜单并点击??
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python+selenium自动化测试定位下拉菜单并点击??相关的知识,希望对你有一定的参考价值。
请问怎么写下图中的菜单定位并点击的脚本;
先点击倒三角按钮, 然后点击option value="132"
另外select标签怎么有个editable=false ? 参考技术A
请参考selenium.webdriver.support.select的API.
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 :
value - The value to match against
select_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:
<option value=”foo”>Bar</option>
Args :
index - The option at this index will be selected
select_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见http://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.select.html#selenium.webdriver.support.select.Select.deselect_by_value
以上是关于python+selenium自动化测试定位下拉菜单并点击??的主要内容,如果未能解决你的问题,请参考以下文章
python+selenium2自动化---使用Select类实现下拉列表的定位