3

I'm trying to automate a certain web page that has dropdown lists and I'm facing issue with one of the dropdown list.

Robot script:

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>

The issue is with the last dropdown list. It throws an error

ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated.

However, the other dropdowns get selected successfully.

Also, if the id of the element is changed to "statusId" instead of "status_id" it works fine.

I've tried "Select From List By Value" keyword as well but that results in the same error.

What could be the issue here?

Sameem
  • 831
  • 1
  • 8
  • 23
  • Can you add the HTML for the relevant dropdown? – A. Kootstra Jun 25 '18 at 05:48
  • I've added the HTML code for the dropdown list with the issue and the other that works fine. Would this be sufficient? – Sameem Jun 25 '18 at 06:08
  • Perhaps you have more than one item on the page with the id `status_id`. – Bryan Oakley Jun 25 '18 at 12:05
  • @BryanOakley, There are indeed 2 drop down lists with the same id(select_id) and I hadn't noticed this until you mentioned. What could I do to specify which drop-down to access? – Sameem Jun 26 '18 at 02:15
  • ids should be unique. The best solution is to modify the code to make sure the id is unique. – Bryan Oakley Jun 26 '18 at 02:47
  • This too is a solvable problem. In this [stackoverflow answer](https://stackoverflow.com/a/4008925/6152737) you'll find some suggestions on how to do this with xpath. – A. Kootstra Jun 26 '18 at 06:53
  • Thanks @BryanOakley and Kootstra for your inputs. Now that I know the problem and possible solutions I think I can sort this out. – Sameem Jun 30 '18 at 16:50

1 Answers1

0

Try with:

Set Focus To Element    //*[@id="status_id"]
Select From List By Label    //*[@id="status_id"]    Active