I am trying to check if an element does not exist but it is failing with timeout issue. From my observation, I found out that the driver is first trying to find out that element first and then waiting for the element to go away instead of checking whether an element exists or does not exist immediately. I tried below methods.
1. browser.element.all(selector)
2. browser.driver.findElements(selector)
3. browser.isElementPresent(browser.element(selector))
4. element(selector).isPresent()
Background: When a button is clicked, a modal will appear. It has cancel and save buttons. On click of Cancel button the modal window disappears. Now I am trying to write an expect condition to check if the Modal has disappeared or not.
All above are failing. Please tell me a correct way where I can check if an element exists immediately.
Here is the error for all the above
Error: function timed out after 60000 milliseconds
I am Really not sure, why Protractor is unable to help to me just check if the element is not present in the DOM. I tried all the ways possible. Every method is trying to find whether existing element is being transitioned to not existing state or not. Then why these many APIs if all doing the same job.