Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Callback functions in browser.wait may want browser.ignoreSynchronization = true #2787

@sjelin

Description

@sjelin

A few people have run into problems around synchronization and browser.wait. For instance, if you have some element #elem that appears in 2 seconds and then disappears 5 seconds later, and you write

browser.wait(protractor.ExpectedConditions.presenceOf(by.id('#elem')), 100);

Then your script will hang because ExpectedConditions waits for all timeouts to be resolved, which means that you'll wait until after the element disappears before the first check happens. The solution here would be to do something like:

browser.wait(function() {
  browser.ignoreSynchronization = true;
  var ret = protractor.ExpectedConditions.presenceOf(by.id('#elem'))();
  browser.ignoreSynchronization = false;
  return ret;
}, 100);

Which is ugly but works.

We're not interested in changing the default behavior of browser.wait to automatically disable synchronization in callbacks, since some people want synchronization and turning it off would be confusing. We're open to suggestions if a lot of people are having this problem though.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions