Using CSS selectors instead of XPath locators when searching through siblings

后端 未结 2 1765
半阙折子戏
半阙折子戏 2021-01-19 14:27

Currently, I have the following page object fields:

this.filterTeamDropdown = $(\"filter-item-edit .dropdown button\");
this.teams = this.filterTeamDropdown.         


        
2条回答
  •  無奈伤痛
    2021-01-19 14:52

    There is an another, Protractor-specific way to solve it - use the locator() of the parent element and concatenate to make a child element selector:

    this.filterTeamDropdown = $("filter-item-edit .dropdown button");
    this.teams = this.filterTeamDropdown.$$(this.filterTeamDropdown.locator().value + " + ul li.dropdown-list-item")
    

提交回复
热议问题