我正在尝试使具有下拉列表的某个网页自动化,但是我遇到了其中一个下拉列表的问题。
机器人脚本:
Input Text //*[@id="description"] Test Attribute Robot
Click Element //*[@id="short_description"]
Select From List By Label //*[@id="entity_id"] Location
Select From List By Label //*[@id="format_id"] Value List
Select From List By Label //*[@id="status_id"] Active
HTML:
<select nextfocus="" enterindex="2" select-dropdown="" name="entity_id" id="entity_id" ng-options="entity.id as entity.entity for entity in attributeCtrl.Entities" ng-model="attributeCtrl.Attribute.entity_id" class="form-control select-component input-sm ng-pristine ng-untouched ng-empty ng-invalid ng-invalid-valdr-required ng-valid-valdr-digits ng-invalid-valdr ng-invalid-required" required=""><option value="" disabled="" class="" selected="selected">Select Entity</option>
<option label="Location" value="number:1">Location</option>
<option label="Item" value="number:7">Item</option>
<option label="Vendor" value="number:23">Vendor</option>
<option label="Made To Orders" value="number:314">Made To Orders</option></select>
<select nextfocus="" enterindex="3" name="status_id" id="status_id" ng-options="status.code as status.description for status in attributeCtrl.Status" ng-model="attributeCtrl.Attribute.status_id" class="form-control select-component input-sm ng-pristine ng-untouched ng-empty ng-invalid ng-invalid-valdr-required ng-valid-valdr-digits ng-invalid-valdr ng-invalid-required" required="">
<option value="" disabled="" class="" selected="selected">Select Status</option>
<option label="Pending" value="number:100">Pending</option>
<option label="Active" value="number:200">Active</option>
<option label="Inactive" value="number:300">Inactive</option>
<option label="Discontinued" value="number:400">Discontinued</option></select>
问题出在最后一个下拉列表中。抛出错误
ElementNotVisibleException:消息:元素不可见:元素当前不可见,可能无法操纵。
但是,其他下拉列表已成功选择。
此外,如果元素的ID更改为 “ statusId” 而不是 “ status_id” 效果很好。
我也尝试过“按值选择列表中的内容”关键字,但这会导致相同的错误。
这里可能是什么问题?
答案 0 :(得分:0)
尝试:
Set Focus To Element //*[@id="status_id"]
Select From List By Label //*[@id="status_id"] Active