mardi 6 janvier 2015

Protractor: How can I get the next tag

Is it possible to get an element after another element? (not subelements)


HTML code:



<input id="first-input" type="text"/>
<ul>
<li>1</li>
<li>2</li>
</ul>
<input id="second-input" type="text"/>
<ul>
<li>1</li>
<li>2</li>
</ul>
<input id="third-input" type="text"/>
<ul>
<li>1</li>
<li>2</li>
</ul>


How can I get the ul following element(by.id('second-input'))?


Here's my understanding:



element(by.id('second-input')).element(by.tagName('ul')) // This doesn't work because this looks for sub-elements in <input id="second-input">
element.all(by.tagName('ul')).first() // This doesn't work because it gets the 'ul' following <input id="first-input">
element(by.id('second-input')).element.all(by.tagName('ul')) // This doesn't work because this looks for all 'ul' elements as sub-elements of <input id="second-input">


In my case, these 'ul's don't have unique ids, or anything unique.


Aucun commentaire:

Enregistrer un commentaire