How to write xpath for the ember dropdown.
The value of the value of the id
attribute will keep changing dynamically, everytime you access the AUT(Application Under Test). Hence to interact / click the dropdown you need to construct dynamic Locator Strategies as follows:
cssSelector
:
ul.ember-power-select-options.ember-view[id^='ember-power-select-options-ember']
xpath
:
//ul[starts-with(@id, 'ember-power-select-options-ember') and @class='ember-power-select-options ember-view']
You can find a couple of relevant detailed discussions in:
With xpath:
//ul[contains(@id, 'ember-power-select-options-ember')]
With css:
ul[id*='ember-power-select-options-ember']
Other css:
ul.ember-power-select-options[role=listbox]