Hi all,
I'm recently trying to write marionette test case for text selection,
and have faced some problem on how to send an input character to where
the caret is.
I tried to use sendKeyEvent in nsIDOMWindowUtils with
marionette.execute_script. Here's the code.
/from marionette_test import MarionetteTestCase//
//from marionette import Actions//
///
/class TestTouchCaret(MarionetteTestCase)://
// def test_touchcaret(self)://
// test_html = self.marionette.absolute_url("input.html")//
// self.marionette.navigate(test_html)//
// element = self.marionette.find_element(By.ID, "foo")//
// self.assertEqual("ABC", self.marionette.execute_script("return
arguments[0].value;", [element]))//
////
// element.tap(0,0)//
// self.marionette.execute_script("""//
// let Ci = Components.interfaces;//
// var win = document.defaultView;//
// let domWindowUtils =
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);//
// domWindowUtils.sendKeyEvent('keypress', 0, 96, 0);//
// """)/
but it kept sending
/JavascriptException: JavascriptException: [Exception... "Could not
convert JavaScript argument arg 0 [nsISupports.QueryInterface]"
nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS
frame :: dummy file :: __marionetteFunc :: line 3" data: no]//
/
I'm not sure what the problem is, can anyone who is familiar with
marionette help me figure this out? thanks.
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g