mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.11k stars 1.52k forks source link

WebDriver:ExecuteScript returns null where no null is possible #1992

Open minj opened 2 years ago

minj commented 2 years ago

System

Testcase

Document unavailable (not public).

Error intermittent only: unexpected null is returned from WebDriver:ExecuteScript where no null is theoretically possible.

See line 60 (Marionette request on 1646144672743):

return globalThis?.window?.jQuery?.readyWait ?? -1; returns null.

I am eager to know how that is possible :smile:

NOTE: Error first noticed trying to upgrade from FF v78.15.0 esr to v91.6.0 esr, but seems to be introduced with FF v84.0b1.

I suspect https://bugzilla.mozilla.org/show_bug.cgi?id=1669172 or something related

Stacktrace

No stacktrace on the geckodriver. Unexpected null result leads to NullReferenceException on the client.

Trace-level log

trace.log

whimboo commented 2 years ago

Well, what is globalThis?.window?.jQuery?.readyWait? Maybe you could add some dump() lines to the JS script so it prints the value of the individual properties like dump(\n** window: ${globalThis.window}\n`);

minj commented 2 years ago

It's either a number or it coalesces to -1. So it should always be a number.

Regardless as clearly visible in the log, the result is null, which should not be possible.

Please don't interrogate my code, I know how it works. What I would like to know is, why geckodriver gives up and just gives me null intermittently.

My suspicion is, this is some sort of race condition related to the following: MarionetteCommands actor created for window id

whimboo commented 2 years ago

Note that the discussion was moved to https://bugzilla.mozilla.org/show_bug.cgi?id=1761634 by the author of this issue.