Pythonでmerionetteを使用して、フィーチャーフォンのFirefox OSで自動化を行っています。
私の問題は、一部のアプリケーションでナビゲーション キーやその他の選択キーのハードウェア キーイベントをシミュレートできないことです (以下の場合、名前は ApplicationName です)。ただし、ネイティブアプリで使用できます。
以下は私のコードスニペットです:
#creating marionette client on port 2828
client = Marionette('localhost', port=2828)
client.start_session()
#import js script to launch app by name
js = os.path.abspath("/usr/local/script.js")
client.import_script(js)
result=client.execute_async_script("GaiaApps.launchWithName('%s')" % "ApplicationName")
client.switch_to_frame(result.get("frame"))
num = "123456"
client.find_element('css selector','input[type=text]').send_keys(num)
#Above code is working fine
#below code is not working on some thirdparty applications
client.execute_script("window.dispatchEvent(new KeyboardEvent('keydown', {key: 'ArrowDown', keyCode: 40}))")
#closing the client
client.close
原因は何ですか?