Is it possible to get the next brother using cssContainingText in Protractor

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

Example: HTML code looks like this:

<div ng-repeat="SomeNgRepeat" class="ng-scope">
    <div class="text-label" >SomeText</div>
    <div class="some-class">SomeValue</div>
</div>

Get an item using:

element(by.cssContainingText('div.text-label','SomeText'))

Now find the next brother of the above item.

I know a way to css=form input.username + inputfind a sibling. However, this does not work in my case!

I think that to achieve this goal you can use the "chain", but I do not know how!

Thanks, Sakshi

+4
source share
2 answers

What if you get it at a time using by.xpath():

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

cssContainingText():

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

node.nextSibling.

0

All Articles