Styrow.dev
Question 26 of 36

How do you verify whether an element exists on a webpage using Protractor?

Question

How do you verify whether an element exists on a webpage using Protractor?

Answer

To determine whether an element exists on a webpage with isPresent function

// Element exists expect(element(by.binding(‘person.name’)).isPresent()).toBe(true);

// Element not present expect(element(by.binding(‘notPresent’)).isPresent()).toBe(false);