本文整理汇总了Python中marionette.Marionette.status方法的典型用法代码示例。如果您正苦于以下问题:Python Marionette.status方法的具体用法?Python Marionette.status怎么用?Python Marionette.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marionette.Marionette
的用法示例。
在下文中一共展示了Marionette.status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _StartProcess
# 需要导入模块: from marionette import Marionette [as 别名]
# 或者: from marionette.Marionette import status [as 别名]
def _StartProcess(self):
if not self.isEmulatorInitialized:
print("Starting Emulator ...")
self.emulatorProcess = subprocess.Popen(
[self.emulatorStartScript], cwd=os.path.dirname(self.emulatorStartScript), shell=True)
# adb shell setprop net.dns1 10.0.2.3
self._isBootFinished()
self.monitoringProcessId = self.adb.getPID(self.monitoredProcessName)
print("Forwarding TCP port %d ..." % self.forwardedPortADB)
self.adb.command(["forward", "tcp:%d" % self.forwardedPortADB, "tcp:%d" % self.forwardedPortADB])
self.isEmulatorInitialized = True
time.sleep(20)
if self.crashSuccess:
print("Restarting %s ..." % self.monitoredProcessName)
self.adb.killProcess(self.monitoredProcessName, True)
time.sleep(40)
self.monitoringProcessId = self.adb.getPID(self.monitoredProcessName)
self.crashSuccess = False
self.debugLogData = str()
self.adb.checkCmd(["logcat", "-c"])
print("Starting Marionette session ...")
marionette = Marionette('localhost', self.forwardedPortADB)
print(marionette.status())
marionette.start_session()
marionette.set_script_timeout(self.scriptTimeout)
marionette.switch_to_frame()
lock = gaia.LockScreen(marionette)
lock.unlock()
apps = gaia.GaiaApps(marionette)
print(apps.runningApps())
print("Launching Browser application")
apps.launch(self.appName, switch_to_frame=True)
print("Navigating to %s ..." % self.publisherURL)
marionette.execute_script("return window.wrappedJSObject.Browser.navigate('%s')" % self.publisherURL)
self.isMonitorInitialized = True
示例2: TestServer
# 需要导入模块: from marionette import Marionette [as 别名]
# 或者: from marionette.Marionette import status [as 别名]
import threading
from testserver import TestServer
from marionette import Marionette, HTMLElement
if __name__ == '__main__':
# start the test server
server = TestServer(2626)
thread = threading.Thread(target=server.run)
thread.daemon = True
thread.start()
# run some trivial unit tests which just verify the protocol
m = Marionette(host='localhost', port=2626)
assert(m.status()['os']['arch'] == 'x86')
assert(m.start_session())
assert(m.get_session_capabilities()['javascriptEnabled'] == True)
assert(m.get_window() == server.TEST_CURRENT_WINDOW)
assert(m.window == server.TEST_CURRENT_WINDOW)
assert(m.get_windows() == server.TEST_WINDOW_LIST)
assert(m.switch_to_window('window2'))
assert(m.window == 'window2')
assert(m.close_window('window2'))
assert(m.set_script_timeout(1000))
assert(m.set_search_timeout(500))
assert(m.get_url() == server.TEST_URL)
assert(m.navigate(server.TEST_URL))
assert(m.go_back())
assert(m.go_forward())
assert(m.refresh())