javascript - Protractor: Compare two element for equality -


i have list of elements

list = element.all(by.css(....)); 

one of them has specific attribute

specific = list.element(by.css('[active]'); 

now check if specific element first

expect(list.get(0)).tobe(specific) 

however doesn't work (it doesn't match). suggestion how compare elements?

you can value of active attribute , see if not null:

expect(list.first().getattribute("active")).not.tobenull(); 

you cannot though directly compare elements, but, can compare ids or outerhtml attribute values of elements:

expect(list.first().getid()).toequal(specific.id()); expect(list.first().getattribute("outerhtml")).toequal(specific.getattribute("outerhtml")); 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -