本文整理汇总了Python中marionette.Marionette.setup_touch方法的典型用法代码示例。如果您正苦于以下问题:Python Marionette.setup_touch方法的具体用法?Python Marionette.setup_touch怎么用?Python Marionette.setup_touch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marionette.Marionette
的用法示例。
在下文中一共展示了Marionette.setup_touch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_up_device
# 需要导入模块: from marionette import Marionette [as 别名]
# 或者: from marionette.Marionette import setup_touch [as 别名]
def set_up_device(opt):
if not opt.wifi_ssid or not opt.wifi_key or not opt.wifi_pass:
raise ValueError('Missing --wifi options')
mc = Marionette('localhost', opt.adb_port)
for i in range(2):
try:
mc.start_session()
break
except socket.error:
sh('adb forward tcp:%s tcp:%s' % (opt.adb_port, opt.adb_port))
if opt.shell:
from pdb import set_trace
set_trace()
return
# watch out! This is how gaiatest does it.
mc.__class__ = type('Marionette', (Marionette, MarionetteTouchMixin), {})
device = GaiaDevice(mc)
device.restart_b2g()
apps = GaiaApps(mc)
data_layer = GaiaData(mc)
lockscreen = LockScreen(mc)
mc.setup_touch()
lockscreen.unlock()
apps.kill_all()
data_layer.enable_wifi()
if opt.wifi_key == 'WPA-PSK':
pass_key = 'psk'
elif opt.wifi_key == 'WEP':
pass_key = 'wep'
else:
assert 0, 'unknown key management'
data = {'ssid': opt.wifi_ssid, 'keyManagement': opt.wifi_key,
pass_key: opt.wifi_pass}
data_layer.connect_to_wifi(data)
mc.switch_to_frame()
all_apps = set(a['manifest']['name'] for a in get_installed(apps))
if 'Marketplace Dev' not in all_apps:
mc.execute_script(
'navigator.mozApps.install'
'("https://marketplace-dev.allizom.org/manifest.webapp");')
wait_for_element_displayed(mc, 'id', 'app-install-install-button')
yes = mc.find_element('id', 'app-install-install-button')
mc.tap(yes)
wait_for_element_displayed(mc, 'id', 'system-banner')
print 'Pushing payment prefs'
sh('adb shell stop b2g')
sh('adb push "%s" /data/local/user.js' % (
os.path.join(os.path.dirname(__file__), 'payment-prefs.js')))
sh('adb shell start b2g')
print 'When your device reboots, Marketplace Dev will be installed'