我如何 select 下拉菜单并单击带有 watir webdriver 的下拉项
How can I select drop down menu and click on the drop down item with watir webdriver
我点击下拉菜单的代码:
browser.select_list(:class => "ui-select-match").click
我的代码到列表中的 select:
browser.select_list(:name => "system-parameter").clear
puts browser.select_list(:name => "system-parameter").options
browser.select_list(:name => "system-parameter").select("Brand")
HTML 单击下拉菜单:
<div class="ui-select-match" ng-hide="$select.open" ng-disabled="$select.disabled" ng-class="{'btn-default-focus':$select.focus}" placeholder="Select System Parameter">
<span tabindex="-1" class="btn btn-default form-control ui-select-toggle" aria-label="Select box activate" ng-disabled="$select.disabled" ng-click="$select.activate()" style="outline: 0;">
<span ng-show="$select.isEmpty()" class="ui-select-placeholder text-muted ng-binding">Select System Parameter</span>
<span ng-hide="$select.isEmpty()" class="ui-select-match-text pull-left ng-hide" ng-class="{'ui-select-allow-clear': $select.allowClear && !$select.isEmpty()}" ng-transclude="">
<span class="ng-binding ng-scope"></span>
</span> <i class="caret pull-right" ng-click="$select.toggle($event)">
</i> <a ng-show="$select.allowClear && !$select.isEmpty()" aria-label="Select box clear" style="margin-right: 10px" ng-click="$select.clear($event)" class="btn btn-xs btn-link pull-right ng-hide">
<i class="glyphicon glyphicon-remove" aria-hidden="true">
</i>
</a>
</span>
</div>
HTML 从列表中编码到 select:
<a href="javascript:void(0)" class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="constant.Value | highlight: $select.search" name="Brand" class="ng-binding ng-scope">Brand</div>
</a>
<a href="javascript:void(0)" class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="constant.Value | highlight: $select.search" name="Group" class="ng-binding ng-scope">Group</div>
</a>
<a href="javascript:void(0)" class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="constant.Value | highlight: $select.search" name="Unit" class="ng-binding ng-scope">Unit</div>
</a>
我正在尝试单击下拉列表,但无法从列表中也select。
根据 ruby 文档建议
,您需要对 select
标签内的元素使用 select_list
在这里查看更多
Class::Watir::SelectList
我点击下拉菜单的代码:
browser.select_list(:class => "ui-select-match").click
我的代码到列表中的 select:
browser.select_list(:name => "system-parameter").clear
puts browser.select_list(:name => "system-parameter").options
browser.select_list(:name => "system-parameter").select("Brand")
HTML 单击下拉菜单:
<div class="ui-select-match" ng-hide="$select.open" ng-disabled="$select.disabled" ng-class="{'btn-default-focus':$select.focus}" placeholder="Select System Parameter">
<span tabindex="-1" class="btn btn-default form-control ui-select-toggle" aria-label="Select box activate" ng-disabled="$select.disabled" ng-click="$select.activate()" style="outline: 0;">
<span ng-show="$select.isEmpty()" class="ui-select-placeholder text-muted ng-binding">Select System Parameter</span>
<span ng-hide="$select.isEmpty()" class="ui-select-match-text pull-left ng-hide" ng-class="{'ui-select-allow-clear': $select.allowClear && !$select.isEmpty()}" ng-transclude="">
<span class="ng-binding ng-scope"></span>
</span> <i class="caret pull-right" ng-click="$select.toggle($event)">
</i> <a ng-show="$select.allowClear && !$select.isEmpty()" aria-label="Select box clear" style="margin-right: 10px" ng-click="$select.clear($event)" class="btn btn-xs btn-link pull-right ng-hide">
<i class="glyphicon glyphicon-remove" aria-hidden="true">
</i>
</a>
</span>
</div>
HTML 从列表中编码到 select:
<a href="javascript:void(0)" class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="constant.Value | highlight: $select.search" name="Brand" class="ng-binding ng-scope">Brand</div>
</a>
<a href="javascript:void(0)" class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="constant.Value | highlight: $select.search" name="Group" class="ng-binding ng-scope">Group</div>
</a>
<a href="javascript:void(0)" class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="constant.Value | highlight: $select.search" name="Unit" class="ng-binding ng-scope">Unit</div>
</a>
我正在尝试单击下拉列表,但无法从列表中也select。
根据 ruby 文档建议
,您需要对select
标签内的元素使用 select_list
在这里查看更多 Class::Watir::SelectList