如何使用Selenium IDE从下拉列表中选择值

Ani*_*nil 9 ide selenium drop-down-menu

我首先使用Selenium IDE,并且不了解自动化脚本.到目前为止,我能够使用IDE进行管理,但有一个问题是我无法从下拉列表中随机选择值,而是每次手动输入索引或标签值.

任何人都可以帮我这个.

谢谢

小智 11

我尝试了下面的工作

命令:选择

目标:元素定位器例如:id = card

值:index = 1


Ran*_*ddy 1

使用 command select(selectLocator, optionLocator),“selectLocator”是从中选择值的下拉列表的 ID,“optionLocator”是要选择的值。

例如:假设一个下拉菜单具有Id="//select[@id='type'"“TypeA、TypeB、TypeC、...”等值。如果您从下拉列表中选择“TypeA”,您的命令应如下所示:

selenium.select("//select[@id='type']", "label=TypeA");
Run Code Online (Sandbox Code Playgroud)

我希望这能解决您的问题。