Closed
Bug 825858
Opened 12 years ago
Closed 12 years ago
marionette.execute_script (JQuery):errors.JavascriptException: ReferenceError: $ is not defined when executing JS to find element in DOM
Categories
(Remote Protocol :: Marionette, defect)
Remote Protocol
Marionette
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: saurabh.webaroo, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.101 Safari/537.11 Steps to reproduce: Steps:- from marionette import Marionette marionette = Marionette('localhost', 2828) marionette.start_session() marionette.navigate("https://s3.amazonaws.com/webds/Canvas/test/4.0.17/platform.html") marionette.execute_script("return $('#code').text();", new_sandbox=False) Actual results: StackTrace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "marionette.py", line 423, in execute_script specialPowers=special_powers) File "marionette.py", line 188, in _send_message self._handle_error(response) File "marionette.py", line 223, in _handle_error raise JavascriptException(message=message, status=status, stacktrace=stacktrace) errors.JavascriptException: ReferenceError: $ is not defined stacktrace: __marionetteFunc@chrome://marionette/content/marionette-listener.js:416 @chrome://marionette/content/marionette-listener.js:416 Expected results: It should return pair of 3 digit code.
Comment 1•12 years ago
|
||
This is because $ is a non-standard member of the window object, so you'll have to access it using: window.wrappedJSObject.$ It's described here: https://developer.mozilla.org/en-US/docs/Marionette/Marionette#execute_script() And there's a bug about removing the need for wrappedJSObject here: https://bugzilla.mozilla.org/show_bug.cgi?id=825961
Reporter | ||
Comment 2•12 years ago
|
||
Thanks Malini it works perfectly now.
Updated•12 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•