question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

browser.wait() doesn't seem to work as documented

See original GitHub issue

As documented here: http://zombie.labnotes.org/API#browser-wait-done-callback the wait() function should accept two functions as arguments, the first of which is a return condition that, once met, will run the second argument function.

However, in my mocha test, this is a failing example of a try at this, and the second function still runs, even though the first return returns false.

I’m honestly not even sure the hashChanged function is ever run, any attempt to put a debugger; or console.log( ... ); in the function never seems to catch or output anything.

it('should change the location hash', function (done) {
    function hashChanged (window) {
        return window.location.hash === 'THIS IS NEVER, AND WILL NEVER BE TRUE!';
    }

    browser.pressButton('sign-in', function (err) {
        expect(err).to.be.undefined;

        browser.wait(hashChanged, function () {
            browser.evaluate('window.location.hash').should.equal('#');

            done();
        });
    });
});

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JohnPostlethwaitcommented, Mar 12, 2014

Ah! Maybe that is my real issue then…

My application connects the socket, and then fills out the HTML page with the data it gets over-the-wire, which I was trying to wait for with the above examples…

0reactions
JohnPostlethwaitcommented, Mar 12, 2014

Ok, thanks for all the help with this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does browser.wait seem to work even with a wait time of 0?
var wait = 0 // Count to three then change content to 'Times up' var timeout = setTimeout(timesUp, wait) function timesUp() { document.body....
Read more >
browser.wait() does not work when there is no spinner #4481
I am facing very weird behaviour of browser.wait(). In my test website sometime Spinner appear and sometime it does not appear to handle ......
Read more >
Protractor: how to write a test that waits for a screen element to ...
I've looked at the object returned by browser.getCurrentUrl(), and it doesn't have any methods that allow comparison with another value. Any suggestions? I'm ......
Read more >
How To Wait For Element In WebdriverIO - YouTube
In this video, we will discuss how to wait for some element which is not displayed. We will use waitForDisplayed () from wdio...
Read more >
WebDriver - W3C
WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform- and language-neutral ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found