Let me check these example on Monday and get back to you (vibration and battery 
are not APIs we use in our daily test automation because it's hard to validate 
the input and output).

In the meantime if you want some examples of how we use the Python Marionette 
client with Fx OS APIs you can look here:
https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaia-ui-tests/gaiatest/gaia_test.py


----- Original Message -----
From: Craig Comstock <[email protected]>
To: Zac Campbell <[email protected]>
Cc: Mozilla B2G mailing list <[email protected]>
Sent: Sat, 08 Feb 2014 05:36:26 -0800 (PST)
Subject: Re: [b2g] marionette script "hanging" on simple javascript...

Thanks Zac,

I think the real problem for me is that the javascript functions don't seem to 
do what I expect.

vibrate() doesn't cause a vibration.

returning .battery doesn't return.

I tried execute_script first and that didn't work so I tried async.

Is it some sort of context or permissions problem?

FWIW I have a near constant stream of the following in logcat....

E/GeckoConsole(  109): [JavaScript Warning: "Empty string passed to 
getElementById()." {file: "chrome://marionette/content/marionette-elements.js" 
line: 164}]

My UI was stuck, i.e. screen black and not responding so I kill HUPd b2g to 
recover.

Thanks,
Craig




________________________________
 From: Zac Campbell <[email protected]>
To: Craig Comstock <[email protected]> 
Cc: Mozilla B2G mailing list <[email protected]> 
Sent: Saturday, February 8, 2014 4:22 AM
Subject: Re: [b2g] marionette script "hanging" on simple javascript...
 

Hi Craig, execute_async_script expects a callback from marionetteScriptFinished 
and if doesn't get it it will time out.

If you use just execute_script instead of execute_async_script it should work.

Or I think you need to do 
execute_async_script("marionetteScriptFinished(navigator.battery)")

(disclaimer untested as I don't have my phone here right now but I think you 
can work it out!)



----- Original Message -----
From: Craig Comstock <[email protected]>
To: Mozilla B2G mailing list <[email protected]>
Sent: Fri, 07 Feb 2014 18:37:15 -0800 (PST)
Subject: [b2g] marionette script "hanging" on simple javascript...

Maybe I'm not understanding something quite right but I was trying to write 
some python/marionette scripts and the basics detailed here:

https://developer.mozilla.org/en-US/Firefox_OS/Platform/Automated_testing/Marionette_for_interactive_Python?redirectlocale=en-US&redirectslug=Mozilla%2FFirefox_OS%2FPlatform%2FTesting%2FMarionette_for_interactive_Python

Just don't seem to work... i.e. returning navigator.battery doesn't work, but 
navigator.battery.level does. Making a phone call seems to work but vibrate 
doesn't.

Any ideas why?

I'm running these scripts locally on my keon phone w/ debian installed as well 
to provide python/gcc/etc...

Here's a script that doesn't do anything:

#!/usr/bin/python

from marionette import Marionette
marionette = Marionette('localhost',2828)
marionette.start_session()

result = marionette.execute_async_script("""
        return navigator.vibrate(50);
""")

print(result)



Thanks,
Craig
_______________________________________________
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
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to