• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python marionette.Marionette类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中marionette.Marionette的典型用法代码示例。如果您正苦于以下问题:Python Marionette类的具体用法?Python Marionette怎么用?Python Marionette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Marionette类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_marionette

 def get_marionette(self):
     if not self.m:
         self.m = Marionette(port=self.port)
         self.m.start_session()
         self.device = GaiaDevice(self.m)
         self.device.add_device_manager(self.dm)
         self.gaia_apps = GaiaApps(self.m)
     else:
         tries = 5
         while tries > 0:
             try:
                 self.m.get_url()
                 break
             except MarionetteException as e:
                 if "Please start a session" in str(e):
                     time.sleep(5)
                     self.m = Marionette(port=self.port)
                     self.m.start_session()
                     self.device = GaiaDevice(self.m)
                     self.device.add_device_manager(self.dm)
                     self.gaia_apps = GaiaApps(self.m)
                     tries -= 1
                 else:
                     raise e
         else:
             self.run_log.error("Can't connect to marionette, rebooting")
             self.restart_device()
     return self.m
开发者ID:malini,项目名称:marketplace_tests,代码行数:28,代码来源:app_checker.py


示例2: cli

def cli():
    parser = OptionParser(usage='%prog gaia_atoms_path app_name [app_name] ...')

    options, args = parser.parse_args()

    if not args:
        parser.print_usage()
        parser.exit()

    if not os.path.isdir(args[0]):
        parser.print_usage()
        print 'must specify valid path for gaia atoms'
        parser.exit()

    if len(args) != 2:
        parser.print_usage()
        print 'must specify at one app name'
        parser.exit()

    marionette = Marionette(host='localhost', port=2828)  # TODO command line option for address
    marionette.start_session()
    launchApp(
        marionette,
        gaia_atoms=args[0],
        app_name=args[1])
开发者ID:bobsilverberg,项目名称:b2gperf,代码行数:25,代码来源:simple_launch.py


示例3: run_marionette

 def run_marionette(self, dir):
     self.logger.info("Starting test run")
     # Start up marionette
     m = Marionette(emulator=True, homedir=dir)
     assert m.start_session()
     for test in self.testlist:
         run_test(test, m)
     m.delete_session()
开发者ID:ctalbert,项目名称:marionette_client,代码行数:8,代码来源:automator.py


示例4: get_new_emulator

 def get_new_emulator(self):
     _qemu  = Marionette(emulator=True,
                         homedir=self.marionette.homedir,
                         baseurl=self.marionette.baseurl,
                         noWindow=self.marionette.noWindow)
     _qemu.start_session()
     self._qemu.append(_qemu)
     return _qemu
开发者ID:Kml55,项目名称:marionette_client,代码行数:8,代码来源:marionette_test.py


示例5: create_marionette

    def create_marionette():
        """Creates a new Marionette session if one does not exist."""

        m = TestCase.stored.marionette

        if not m:
            m = Marionette()
            m.start_session()
            TestCase.stored.marionette = m

        return TestCase.stored.marionette
开发者ID:andreastt,项目名称:fxos-certsuite,代码行数:11,代码来源:tests.py


示例6: get_marionette

def get_marionette(args):
    mc = Marionette('localhost', args.adb_port)
    for i in range(3):
        try:
            mc.start_session()
            break
        # Catching SystemExit because tracebacks are suppressed.
        # This won't be necessary after
        # https://bugzilla.mozilla.org/show_bug.cgi?id=863377
        except (socket.error, SystemExit):
            sh('adb forward tcp:%s tcp:%s' % (args.adb_port, args.adb_port))
    return mc
开发者ID:andymckay,项目名称:ezboot,代码行数:12,代码来源:__init__.py


示例7: get_new_emulator

 def get_new_emulator(self):
     self.extra_emulator_index += 1
     if len(self.marionette.extra_emulators) == self.extra_emulator_index:
         qemu  = Marionette(emulator=self.marionette.emulator.arch,
                            homedir=self.marionette.homedir,
                            baseurl=self.marionette.baseurl,
                            noWindow=self.marionette.noWindow)
         qemu.start_session()
         self.marionette.extra_emulators.append(qemu)
     else:
         qemu = self.marionette.extra_emulators[self.extra_emulator_index]
     return qemu
开发者ID:marshall,项目名称:mozilla-central,代码行数:12,代码来源:marionette_test.py


示例8: start_marionette

    def start_marionette(self):
        assert(self.baseurl is not None)
        if self.bin:
            if self.address:
                host, port = self.address.split(':')
            else:
                host = 'localhost'
                port = 2828
            self.marionette = Marionette(host=host,
                                         port=int(port),
                                         app=self.app,
                                         bin=self.bin,
                                         profile=self.profile,
                                         baseurl=self.baseurl,
                                         timeout=self.timeout)
        elif self.address:
            host, port = self.address.split(':')
            try:
                #establish a telnet connection so we can vertify the data come back
                tlconnection = Telnet(host, port)
            except:
                raise Exception("could not connect to given marionette host/port")

            if self.emulator:
                self.marionette = Marionette.getMarionetteOrExit(
                                             host=host, port=int(port),
                                             connectToRunningEmulator=True,
                                             homedir=self.homedir,
                                             baseurl=self.baseurl,
                                             logcat_dir=self.logcat_dir,
                                             gecko_path=self.gecko_path,
                                             symbols_path=self.symbols_path,
                                             timeout=self.timeout)
            else:
                self.marionette = Marionette(host=host,
                                             port=int(port),
                                             baseurl=self.baseurl,
                                             timeout=self.timeout)
        elif self.emulator:
            self.marionette = Marionette.getMarionetteOrExit(
                                         emulator=self.emulator,
                                         emulatorBinary=self.emulatorBinary,
                                         emulatorImg=self.emulatorImg,
                                         emulator_res=self.emulator_res,
                                         homedir=self.homedir,
                                         baseurl=self.baseurl,
                                         noWindow=self.noWindow,
                                         logcat_dir=self.logcat_dir,
                                         gecko_path=self.gecko_path,
                                         symbols_path=self.symbols_path,
                                         timeout=self.timeout)
        else:
            raise Exception("must specify binary, address or emulator")
开发者ID:sergecodd,项目名称:FireFox-OS,代码行数:53,代码来源:runtests.py


示例9: ftu_toggler

def ftu_toggler(skip_ftu=True):
    dm = mozdevice.DeviceManagerADB(runAdbAsRoot=True)
    dm.forward("tcp:2828", "tcp:2828")

    m = Marionette()
    m.start_session()
    data_layer = GaiaData(m)
    url = "null" if skip_ftu else "app://ftu.gaiamobile.org/manifest.webapp"
    data_layer.set_setting('ftu.manifestURL', url)
    m.close()

    # restart b2g to enable
    dm.reboot()
开发者ID:Conjuror,项目名称:dev-tools,代码行数:13,代码来源:skip_ftu.py


示例10: startMarionette

def startMarionette():
    # FW port for ADB via USB
    return_code = subprocess.call(["adb root"], shell=True)
    if return_code:
        raise Exception("Failed to start adb in root mode. Ensure device is attached to USB.")
    return_code = subprocess.call(["adb forward tcp:2828 tcp:2828"], shell=True)
    if return_code:
        raise Exception("Failed to connect to device via ADB; ensure device is attached to USB.")
    # Start Marionette
    marionette = Marionette(host='localhost', port=2828)
    marionette.start_session()
    marionette.set_script_timeout(60000)
    return marionette
开发者ID:Mozilla-Games,项目名称:speedtests,代码行数:13,代码来源:B2GBrowserControllers.py


示例11: create_marionette

    def create_marionette():
        """Returns current Marionette session, or creates one if
        one does not exist.

        """

        m = TestCase.stored.marionette
        if m is None:
            m = Marionette()
            m.wait_for_port()
            m.start_session()
            TestCase.stored.marionette = m

        return TestCase.stored.marionette
开发者ID:jonallengriffin,项目名称:fxos-certsuite,代码行数:14,代码来源:testcase.py


示例12: setup

 def setup(self):
     try:
         self.client = Marionette(host='localhost', port=2828)
         self.client.start_session()
         self.client.set_pref('general.warnOnAboutConfig', False)
     except:
         sys.exit("Could not find Firefox browser running")
开发者ID:stuartphilp,项目名称:marionnette_webconsole,代码行数:7,代码来源:marionnette_webconsole_example.py


示例13: run_desktop_mochitests

def run_desktop_mochitests(parser, options):
    # create our Marionette instance
    kwargs = {}
    if options.marionette:
        host, port = options.marionette.split(':')
        kwargs['host'] = host
        kwargs['port'] = int(port)
    marionette = Marionette.getMarionetteOrExit(**kwargs)
    mochitest = B2GDesktopMochitest(marionette, options.profile_data_dir)

    # add a -bin suffix if b2g-bin exists, but just b2g was specified
    if options.app[-4:] != '-bin':
        if os.path.isfile("%s-bin" % options.app):
            options.app = "%s-bin" % options.app

    options = MochitestOptions.verifyOptions(parser, options, mochitest)
    if options == None:
        sys.exit(1)

    if options.desktop and not options.profile:
        raise Exception("must specify --profile when specifying --desktop")

    options.browserArgs += ['-marionette']

    sys.exit(mochitest.runTests(options, onLaunch=mochitest.startTests))
开发者ID:elefant,项目名称:gecko-dev,代码行数:25,代码来源:runtestsb2g.py


示例14: restart_device

 def restart_device(self, restart_tries=0):
     self.run_log.info("rebooting")
     # TODO restarting b2g doesn't seem to work... reboot then
     while restart_tries < 3:
         restart_tries += 1
         self.dm.reboot(wait=True)
         self.run_log.info("forwarding")
         if not self.forward_port():
             self.run_log.error("couldn't forward port in time, rebooting")
             continue
         self.m = Marionette(port=self.port)
         if not self.m.wait_for_port(180):
             self.run_log.error("couldn't contact marionette in time, rebooting")
             continue
         time.sleep(1)
         self.m.start_session()
         try:
             Wait(self.m, timeout=240).until(lambda m: m.find_element("id", "lockscreen-container").is_displayed())
             # It retuns a little early
             time.sleep(2)
             self.device = GaiaDevice(self.m)
             self.device.add_device_manager(self.dm)
             self.device.unlock()
             self.gaia_apps = GaiaApps(self.m)
         except (MarionetteException, IOError, socket.error) as e:
             self.run_log.error("got exception: %s, going to retry" % e)
             try:
                 self.m.delete_session()
             except:
                 # at least attempt to clear the session if possible
                 pass
             continue
         break
     else:
         raise Exception("Couldn't restart the device in time, even after 3 tries")
开发者ID:malini,项目名称:marketplace_tests,代码行数:35,代码来源:app_checker.py


示例15: _StartProcess

    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
开发者ID:KurSh,项目名称:peach,代码行数:47,代码来源:b2g.py


示例16: init

def init():
    ret = subprocess.check_output("adb devices", shell=True)
#    if("unagi" in ret):
#        print(ret)
#    else:
#        print("No unagi connected")
#        sys.exit(1)
    import socket
    s = socket.socket()
    try:
        s.bind(("localhost", 2828))
        s.close()
        ret = subprocess.check_output("adb forward tcp:2828 tcp:2828", shell=True)
    except socket.error:
        print("address already in use")
    mar = Marionette()
    mar.start_session()
    return mar
开发者ID:3r1ccc,项目名称:m_viewer,代码行数:18,代码来源:m_viewer.py


示例17: unplug_and_instruct

 def unplug_and_instruct(self, message):
     self.instruct(
         "Unplug the phone.\n%s\nPlug the phone back in after you are "
         "done, and unlock the screen if necessary.\n" % message)
     dm = mozdevice.DeviceManagerADB()
     dm.forward("tcp:2828", "tcp:2828")
     self.marionette = Marionette()
     self.marionette.start_session()
     self.use_cert_app()
开发者ID:JJTC-PX,项目名称:fxos-certsuite,代码行数:9,代码来源:testcase.py


示例18: init

def init():
    ret = subprocess.check_output("adb devices", shell=True)
    print(ret)
    ## TODO: find more error handling if available

    import socket
    s = socket.socket()
    try:
        s.bind(("localhost", 2828))
        s.close()
        ret = subprocess.check_output(
            "adb forward tcp:2828 tcp:2828",
            shell=True
            )
    except socket.error:
        print("address already in use")
    mar = Marionette()
    mar.start_session()
    return mar
开发者ID:zapion,项目名称:m_viewer,代码行数:19,代码来源:m_viewer.py


示例19: restart_b2g

 def restart_b2g(self):
     #restart b2g so we start with a clean slate
     self.dm.checkCmd(['shell', 'stop', 'b2g'])
     # Wait for a bit to make sure B2G has completely shut down.
     time.sleep(10)
     self.dm.checkCmd(['shell', 'start', 'b2g'])
     
     #wait for marionette port to come up
     if not self.wait_for_port(30000):
         raise Exception("Could not communicate with Marionette port after restarting B2G")
     self.marionette = Marionette(self.marionette_host, self.marionette_port)
开发者ID:bgirard,项目名称:eideticker,代码行数:11,代码来源:runner.py


示例20: run_marionette_script

    def run_marionette_script(self):
        self.marionette = Marionette(**self.marionette_args)
        assert(self.marionette.wait_for_port())
        self.marionette.start_session()
        self.marionette.set_context(self.marionette.CONTEXT_CHROME)

        if os.path.isfile(self.test_script):
            f = open(self.test_script, 'r')
            self.test_script = f.read()
            f.close()
        self.marionette.execute_script(self.test_script)
开发者ID:alex-tifrea,项目名称:gecko-dev,代码行数:11,代码来源:b2g_desktop.py



注:本文中的marionette.Marionette类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python marionette.MarionetteTestCase类代码示例发布时间:2022-05-27
下一篇:
Python marionette.EnduranceTestCaseMixin类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap