Reverend Bubbles
Reverend Bubbles

Reputation: 1393

Having trouble chaining element calls in protractor

I know I saw the answer here before. I even used it to successfully build a chain earlier. However, that code is gone, my new code is failing for some reason, and, for the life of me, I cannot find the question on here that gave me the answer, so I'm left with no choice but to ask again.

I have a parent div, with several children divs. I need to pick out the 7th div and check its content against a previously constructed string.

I have the following line:

expect(element(by.css('.textLayer')).element.all(by.tagName('div')).get(6).getText()).toContain(expectedString);

but I'm getting an error:

Failed: element(...).element.all is not a function

I'm not sure what I'm missing.

Please feel free to even point me to the right answer that I know is on here, but somehow, my GoogleFu is failing to locate.

Thanks.

Upvotes: 0

Views: 59

Answers (1)

yong
yong

Reputation: 13712

you should change to

element(by.css('.textLayer')).all(by.tagName('div'))

Upvotes: 1

Related Questions