Thanks for reply.

I've tried to use Marionette send_keys code before, I called element.send_keys("A") after element.tap(0,0) (tap(0,0) place the caret at the beginning of the input field), but it kept appending things at the end of the text, not at the beginning which is what I hope to perform. I'm not sure if this is a bug or it is the correct outcome of the function. If it is correct, is there any other method to solve this problem?/
/

On 2014?03?27? 19:42, David Burns wrote:
Phoebe,

The Marionette send_keys code should put things at the end of the caret, if its not doing that it is a bug and we need to fix that.

As for the error you are seeing it is because you are trying to access a browser chrome API from content which is not allowed.

David

On 27/03/2014 10:07, Phoebe Chang wrote:
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


_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to