Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit waits in page objects #6

Open
Ardesco opened this issue Oct 25, 2013 · 0 comments
Open

Explicit waits in page objects #6

Ardesco opened this issue Oct 25, 2013 · 0 comments

Comments

@Ardesco
Copy link

Ardesco commented Oct 25, 2013

How would you perform an explicit wait inside your page object, the example would be to create a login function in the page object which would do all of the following:

ptor.driver.findElement(protractor.By.id('username')).sendKeys('Jane');
ptor.driver.findElement(protractor.By.id('password')).sendKeys('1234');
ptor.driver.findElement(protractor.By.id('clickme')).click();

// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to
// index.html.
ptor.wait(function() {
  return ptor.driver.getCurrentUrl().then(function(url) {
    return /index/.test(url);
  });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant