Is it possible to get next sibling using cssContainingText in Protractor

前端 未结 3 1819
被撕碎了的回忆
被撕碎了的回忆 2021-01-02 19:58

Is it possible to get the next sibling by using by.cssContainingText()

Example: HTML code is like below:

3条回答
  •  滥情空心
    2021-01-02 20:45

    What if you would get it in one go using by.xpath():

    element(by.xpath('//div[@class="text-label" and . = "SomeText"]/following-sibling::div'))
    

    Or, you can combine it with cssContainingText():

    element(by.cssContainingText('div.text-label','SomeText')).element(by.xpath('following-sibling::div'))
    

提交回复
热议问题