当前位置: 首页>>代码示例>>Python>>正文


Python Marionette.close方法代码示例

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


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

示例1: ftu_toggler

# 需要导入模块: from marionette import Marionette [as 别名]
# 或者: from marionette.Marionette import close [as 别名]
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,代码行数:15,代码来源:skip_ftu.py

示例2: TestConsoleLogCapture

# 需要导入模块: from marionette import Marionette [as 别名]
# 或者: from marionette.Marionette import close [as 别名]
class TestConsoleLogCapture():
    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")

    def test_push_notification_received(self):
        self.client.navigate("https://people.mozilla.org/~ewong2/push-notification-test/")

        unregister_button = self.client.find_element(By.ID, "unreg_btn")
        if unregister_button.is_displayed() == True:
            unregister_button.click()
            Wait(self.client, timeout=5, interval=1).until(expected.element_not_displayed(By.ID, "unreg_btn"))

        Wait(self.client).until(expected.element_displayed(By.ID, "reg_btn"))
        self.client.find_element(By.ID, "reg_btn").click()
        Wait(self.client).until(expected.element_displayed(By.ID, "subscribe_btn"))
        self.client.find_element(By.ID, "subscribe_btn").click()
        Wait(self.client).until(expected.element_displayed(By.ID, "doXhr_btn"))
        self.client.find_element(By.ID, "doXhr_btn").click()

        result = self.web_console_filter_for_string("Received a push message")
        assert result == 1

    def web_console_filter_for_string(self, console_string=None):
        self.client.set_context(self.client.CONTEXT_CHROME)

        handles = self.client.window_handles
        chrome_handles = self.client.chrome_window_handles
        browser_handle = self.client.current_chrome_window_handle
        notifications = 0
        for handle in chrome_handles:
            if handle != browser_handle:
                console_handle = handle
                self.client.switch_to_window(console_handle)
                time.sleep(1)
                results = self.client.find_elements(By.CLASS_NAME, "console-string")
                for result in results:
                    if console_string in result.text:
                        notifications = notifications + 1
        self.client.find_element(By.CLASS_NAME, "webconsole-clear-console-button").click()
        return notifications


    def tear_down(self):
        self.client.close()
开发者ID:stuartphilp,项目名称:marionnette_webconsole,代码行数:51,代码来源:marionnette_webconsole_example.py


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