【问题标题】:How to select a drop down menu value using robot framework?如何使用机器人框架选择下拉菜单值?
【发布时间】:2016-11-24 00:04:49
【问题描述】:

如何从下拉列表中选择订单号。 页面还有一个类似的 2 个下拉菜单,具有相同的 ng-repeat。当我尝试选择一些文本时,它会从其他下拉列表中选择匹配的文本。 text equals 也失败了。

HTML:-

<select ng-repeat="select in controller.getSelects() track by select.key" ng-attr-name="select-{{select.key}}"  name="select-liftId">
<option value="ALL" ng-if="select.default" class="ng-scope">ORDER NUMBER</option>

<option ng-repeat="v in select.options" value="cdfd8775-1114-462b-8a47-bc7a93e0d6ab" ng-selected="v['_id'] === controller.values[select.key]" class="ng-binding ng-scope">   3</option>

<option ng-repeat="v in select.options" value="4f790134-31ab-4212-b152-c5c4101fbe5c" ng-selected="v['_id'] === controller.values[select.key]" class="ng-binding ng-scope">   2</option>

<option ng-repeat="v in select.options" value="8cfb28d3-955c-45b1-877f-56b67edad6ff" ng-selected="v['_id'] === controller.values[select.key]" class="ng-binding ng-scope">   1</option>

到目前为止我尝试了什么:

click element   repeater=v in select.options@row[2]


click element   xpath=//option[text() =${label})]

click element   xpath=//option[contains(text(),'${label}')]

我将不胜感激。谢谢。

更新: 这暂时帮助了我... 点击元素 //select[5]/options[3]

【问题讨论】:

    标签: angularjs python-2.7 selenium robotframework selenium2library


    【解决方案1】:

    点击元素 xpath=//select/option[@value="8cfb28d3-955c-45b1-877f-56b67edad6ff"]

    【讨论】:

      【解决方案2】:

      您需要先使用 get 元素列出选项列表 然后使用索引点击这些列表

      【讨论】:

        猜你喜欢
        • 2014-09-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-13
        • 2017-09-10
        • 2021-12-13
        相关资源
        最近更新 更多