TestProject Forum
Powered by leading experts in the test automation community

Test Fails on a Text(selection) combo box unable to select a value

So I have a Test that I recorded, now re-running the test it fails unable to select a value from a drop down, the field characteristics are:

<input type="text" autocomplete="off" valuekey="label" name="loss_information.loss_location.state" fetchsuggestions="function () { [native code] }" triggeronfocus="true" debounce="300" placement="bottom-start" popperappendtobody="true" config="[object Object]" context="[object Object]" scope="fnolWizard" class="el-input__inner" role="textbox" aria-autocomplete="list" aria-controls="id" aria-activedescendant="el-autocomplete-7974-item--1">

this is where its failing: basically the field lets you type in a state abbreviation it finds it in the list and you select the value.

But the test keeps stopping at this field unable to select a value:


Also here is the Element Details for State: Nevada (NV)

Hi Petar,

I’m assuming that typing the abbreviation in the textfield works and the list get narrowed to relevant options, the only thing that needs to addressed is the best way to select the correct State list item element.

One of the options is looking for a specific element with inner text of the required state, e.g. //li[@text = 'NV'], and even better for an item under the drop down, e.g. //select[@id = 'state']/option[@text = 'NV']

If this is a ‘modern’ dropdown with DIVs, then you should narrow the element search results as //div[@id = 'loss_information.loss_location']/input[@text = 'NV']

The best way to come up with the correct locator would be using our Element Explorer inside TestProject recorder and going over the parent elements (this is a the middle tab in the element locator inside TestProject recorder). Using these tools you will be able to create a distinct and reliable locator and not an absolute XPath that might easily break.