python+selenium自动化测试定位下拉菜单并点击??

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python+selenium自动化测试定位下拉菜单并点击??相关的知识,希望对你有一定的参考价值。

请问怎么写下图中的菜单定位并点击的脚本;

那就改用点击来解决.
先点击倒三角按钮, 然后点击option value="132"
另外select标签怎么有个editable=false ?
参考技术A

请参考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:

<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类实现下拉列表的定位

selenium自动化测试03

selenium + python自动化测试unittest框架学习webdriver对页面其他控件操作

selenium中常用的下拉框定位Select

web自动化测试—selenium游览器下拉框操作

python3+selenium自动化测试-下拉选择框13