Protractor - select the next brother of the current item

My code has a list of (tr) elements selected with "protractor.By.repeater". This list loops using "forEach".

In this cycle, the element is clicked, and this click should initiate the inclusion of a new "tr" immediately after the clicked element.

I want to select this new row.

I used:

var nextRow = tr.$(protractor.By.xpath('following-sibling::tr'));

but then:

                nextRow.isDisplayed(function(row){
                    console.log('row', row);
                });

it generates errors such as: "UnknownError: java.util.HashMap cannot be added to java.lang.String"

Is there any other way to achieve what I want to select the next sibling of the current item?

Or did I write something wrong there?

Thanks for any help!

+4
source share
1

, .then , isDisplayed.

:

nextRow.isDisplayed().then(function(visible) {
  console.log('is displayed? ', visible);
});

ElementFinder nextRow , tr ? Protractor $ element(by.css, , webdriver.Locator, , :

var nextRow = tr.$(protractor.By.xpath('following-sibling::tr'));

, , :

var tr = $('table tr.first'); // just guessing here since you didn't provide that code
var nextRow = tr.element(By.xpath('following-sibling::tr'));
+7

All Articles