Ember dropdown selenium xpath

前端 未结 2 859
青春惊慌失措
青春惊慌失措 2020-12-22 06:18

How to write xpath for the ember dropdown.

相关标签:
2条回答
  • 2020-12-22 06:35

    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']
      

    References

    You can find a couple of relevant detailed discussions in:

    • How to click on the ember.js enabled button using Selenium and Python
    • Selenium - Finding element based on ember
    0 讨论(0)
  • 2020-12-22 06:43

    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]
    
    0 讨论(0)
提交回复
热议问题