waitFor* commands timeout on page reload #1775

Open
wvankuipers opened this Issue Dec 16, 2016 · 4 comments

Projects

None yet

2 participants

@wvankuipers
Contributor
wvankuipers commented Dec 16, 2016 edited

The problem

When running a command that is triggering a page reload but has to check if an element is existing (or visible or selected) the waitFor* command gives the following error:

Error: Command execution timed out

Environment

  • WebdriverIO version: 4.5.0
  • Node.js version: 4.7.0 & 7.1.0 (see details)
  • Standalone mode or wdio testrunner: wdio (repl mode & running as script)
  • if wdio testrunner, running synchronous or asynchronous tests: sync
  • Additional wdio packages used (if applicable): not applicable
  • Chrome version: Version 55.0.2883.95 (64-bit)
  • Selenium (standalone) version:
    Java: Oracle Corporation 25.102-b14
    OS: Mac OS X 10.12.2 x86_64
    v2.53.1, with Core v2.53.1. Built from revision a36b8b1

Details

Running in node 4.7.0:

wdio repl chrome

[13:18:47]  DEBUG	Queue has stopped!
[13:18:47]  DEBUG	You can now go into the browser or use the command line as REPL
[13:18:47]  DEBUG	(To exit, press ^C again or type .exit)

> browser.url('http://s.codepen.io/wvankuipers/debug/aBPdjq').click('button').waitForVisible('div.success', 10000);
Error: Command execution timed out
> true

Running in node 7.1.0:

wdio repl chrome

[14:06:26]  DEBUG	Queue has stopped!
[14:06:26]  DEBUG	You can now go into the browser or use the command line as REPL
[14:06:26]  DEBUG	(To exit, press ^C again or type .exit)

> browser.url('http://s.codepen.io/wvankuipers/debug/aBPdjq').click('button').waitForVisible('div.success', 10000);
Error
> true

Link to Selenium/WebdriverIO logs

Node 4.7.0: https://gist.github.com/wvankuipers/63fc8704b9c0997d24ad894d61f1d0a0
Node 7.1.0 : https://gist.github.com/wvankuipers/248cd4269c75fd0501b4f14f74e2a60e

Code To Reproduce Issue [ Good To Have ]

Using this codepen and the following code:

browser.url('http://s.codepen.io/wvankuipers/debug/aBPdjq').click('button').waitForVisible('div.success', 10000);
@wvankuipers
Contributor

I noticed that just after the error the result of:

COMMAND	GET 	 "/wd/hub/session/4d7f97aa-c8c8-46db-9963-7e11de27f14c/element/1/displayed"

Changes from:

RESULT		[{"ELEMENT":"1"}]

to:

RESULT		[{"ELEMENT":"2"}]
@wvankuipers
Contributor

Some more info:

I found out that this promise gets/triggers the timeout:

{ [Error: Promise was rejected with the following reason: timeout]
message: 'Promise was rejected with the following reason: timeout',
type: 'WaitUntilTimeoutError' }

(The message above is captured in the catch handler of the waitForExist command)

This timeout happens at the exact time of the refresh of the site.

@christian-bromann
Member

@wvankuipers when the page reloads all element references are dead and have to be refetched. I can imagine that waitForVisible is still looking for element 1 even though that element doesn't exist anymore. Any updates on this?

@wvankuipers
Contributor

@christian-bromann That was what I was thinking as well, so a new waitFor process is started, the first one fails since the element reference is gone and the second one will resolve. It should be fixed, but unfortunately I didn't had the time to look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment