protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Error: Wait timed out after 3005ms.

Open mrahulreddy opened this issue 10 years ago • 3 comments

Is multiple browser.wait causing error? The application logins, but then it exits with the error above.

The code is as follows:

describe('driven application', function() { it('should login', function() { var address = browser.get('http://hostname#/signin'); element(by.model('username')).clear().sendKeys("xyz"); element(by.model('password')).sendKeys("zyx"); element(by.id('protractor-loginbutton')).click();

    expect(browser.getCurrentUrl()).toMatch('http://hostname/#/dashboard');
    browser.wait(function() {
      browser.executeScript('window.scrollTo(0,200);').then(function () {
      })
    }, 3000);
    browser.wait(function() {
      browser.executeScript('window.scrollTo(0,-200);').then(function () {
      })
    }, 10000);

});

Any other alternate way to do the same?

mrahulreddy avatar Dec 03 '15 10:12 mrahulreddy

Browser.wait evaluates a function or promise that resolves to a boolean; neither of your wait invocations are returning something that resolves to a boolean value, so I believe this is expected (someone please correct me if I am wrong).

That said, Your question is better suited for StackOverflow or Gitter. Please ask a question there with the 'protractor' tag or post in the Gitter Channel to get help.

From the the getting help section of the README:

Please ask usage and debugging questions on StackOverflow (use the "protractor" tag) or in the Angular discussion group. (Please do not ask support questions here on Github.)

NickTomlin avatar Dec 03 '15 14:12 NickTomlin

Thank you @NickTomlin The following code I used to solve my issue.

var elm = element.all(by.css('.your-css')).get(0); browser.executeScript("arguments[0].scrollIntoView();", elm.getWebElement()); elm.click();

Now, please tell whether is that a good approach or a temporary fix.

mrahulreddy avatar Dec 03 '15 16:12 mrahulreddy

Closing as a question. Thanks!

juliemr avatar Dec 03 '15 17:12 juliemr