Skip to content

[js] until.alertIsPresent(): Workaround for GeckoDriver conversion error - #2137

Merged
jleyba merged 4 commits into
SeleniumHQ:masterfrom
JohanLorenzo:workaround-conversion-error
May 23, 2016
Merged

[js] until.alertIsPresent(): Workaround for GeckoDriver conversion error#2137
jleyba merged 4 commits into
SeleniumHQ:masterfrom
JohanLorenzo:workaround-conversion-error

Conversation

@JohanLorenzo

@JohanLorenzo JohanLorenzo commented May 20, 2016

Copy link
Copy Markdown
Contributor

In some occasions, Gecko driver throws an error while waiting on an alert to come (which eventually does). The error comes from this particular line.

Without the workaround, here are the logs I get:

1463762217511   Marionette  TRACE   conn0 -> [0,132,"clickElement",{"id":"9a5bd452-d252-af4e-a358-9c44f119cabf"}]
1463762217520   Marionette  TRACE   conn0 <- [1,132,null,{}]
1463762217522   Marionette  TRACE   conn0 -> [0,133,"getTextFromDialog",{}]
*************************
A coding exception was thrown and uncaught in a Task.

Full message: TypeError: can't convert null to object
Full stack: GeckoDriver.prototype.getTextFromDialog@chrome://marionette/content/driver.js:2708:7
Dispatcher.prototype.execute/req<@chrome://marionette/content/dispatcher.js:126:20
TaskImpl_run@resource://gre/modules/Task.jsm:319:40
TaskImpl@resource://gre/modules/Task.jsm:280:3
createAsyncFunction/asyncFunction@resource://gre/modules/Task.jsm:254:14
Task_spawn@resource://gre/modules/Task.jsm:168:12
Dispatcher.prototype.execute@chrome://marionette/content/dispatcher.js:120:13
Dispatcher.prototype.onPacket@chrome://marionette/content/dispatcher.js:91:5
DebuggerTransport.prototype._onJSONObjectReady/<@chrome://marionette/content/server.js -> resource://devtools/shared/transport/transport.js:479:9
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14

*************************
1463762217524   Marionette  TRACE   conn0 <- [1,133,{"error":"webdriver error","message":"can't convert null to object","stacktrace":null},null]
*************************
A coding exception was thrown in a Promise rejection callback.
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Full message: TypeError: can't convert null to object
Full stack: GeckoDriver.prototype.getTextFromDialog@chrome://marionette/content/driver.js:2708:7
Dispatcher.prototype.execute/req<@chrome://marionette/content/dispatcher.js:126:20
TaskImpl_run@resource://gre/modules/Task.jsm:319:40
TaskImpl@resource://gre/modules/Task.jsm:280:3
createAsyncFunction/asyncFunction@resource://gre/modules/Task.jsm:254:14
Task_spawn@resource://gre/modules/Task.jsm:168:12
Dispatcher.prototype.execute@chrome://marionette/content/dispatcher.js:120:13
Dispatcher.prototype.onPacket@chrome://marionette/content/dispatcher.js:91:5
DebuggerTransport.prototype._onJSONObjectReady/<@chrome://marionette/content/server.js -> resource://devtools/shared/transport/transport.js:479:9
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14

I'm not too sure how to tackle this issue. Nonetheless, I propose this workaround in the meantime. Does that sound okay to you guys @jleyba @AutomatedTester ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for the specific error you are working around:

(e instanceof error.WebDriverError && e.message === `can't convert null to object`)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Thanks for pointing it out.

Added

@jleyba

jleyba commented May 20, 2016

Copy link
Copy Markdown
Contributor

Please update unit_test.js

@AutomatedTester

Copy link
Copy Markdown
Member

Can you also raise a bug on bugzilla? Looks like we need to make sure the right type of exception is thrown which currently isn't being done.

On 20 May 2016, 22:24 +0100, jleybanotifications@github.com, wrote:

Please updateunit_test.js(https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/test/lib/until_test.js#L125)


You are receiving this because you were mentioned.
Reply to this email directly orview it on GitHub(#2137 (comment))

@jleyba jleyba added the C-nodejs JavaScript Bindings label May 21, 2016
@JohanLorenzo

Copy link
Copy Markdown
Contributor Author

Bug for GeckoDriver raised: https://bugzilla.mozilla.org/show_bug.cgi?id=1274924

@JohanLorenzo

Copy link
Copy Markdown
Contributor Author

@jleyba until_test.js updated. Should I add a note in CHANGES.md for workarounds?

@jleyba

jleyba commented May 23, 2016

Copy link
Copy Markdown
Contributor

Yeah, there should probably be a mention in CHANGES
On Mon, May 23, 2016 at 2:26 AM Johan Lorenzo notifications@github.com
wrote:

@jleyba https://github.com/jleyba until_test.js updated. Should I add a
note in CHANGES.md for workarounds?


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#2137 (comment)

@jleyba
jleyba merged commit f9d9671 into SeleniumHQ:master May 23, 2016
JohanLorenzo added a commit to fxbox/foxbox that referenced this pull request May 26, 2016
…er (#489)

* Automate installation of new Gecko Driver
* Use worked around client (see SeleniumHQ/selenium#2137)
* Centralize Alert management in a Wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-nodejs JavaScript Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants