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

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

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -