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


Python Browser.go_to_url方法代码示例

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


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

示例1: test_persona_cookie

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_persona_cookie(self):
        """
        Smoketest of cookie handling/Persona integration
        Log in with Persona user
        After refreshing 123done should still be logged in (cookie retained)
        """
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url('http://firefoxos.123done.org')

        browser.switch_to_content()

        self.wait_for_element_displayed(*self._logged_out_button_locator, timeout=120)

        login_button = self.marionette.find_element(*self._logged_out_button_locator)
        login_button.click()

        persona = Persona(self.marionette)
        persona.login(self.user.email, self.user.password)

        # wait to fall back to browser
        self.wait_for_condition(lambda m: self.apps.displayed_app.name == browser.name)
        self.apps.switch_to_displayed_app()

        browser.switch_to_content()
        self.wait_for_element_displayed(*self._logged_in_button_locator)

        browser.switch_to_chrome()
        # Refresh the page
        browser.tap_go_button()

        # Now we expect B2G to retain the Persona cookie and remain logged in
        browser.switch_to_content()
        self.wait_for_element_displayed(*self._logged_in_button_locator)
开发者ID:Allan019,项目名称:gaia,代码行数:37,代码来源:test_persona_cookie.py

示例2: TestBrowserSearch

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
class TestBrowserSearch(GaiaMtbfTestCase):

    _google_search_input_locator = (By.NAME, 'q')

    def setUp(self):
        GaiaMtbfTestCase.setUp(self)
        self.connect_to_network()

        self.browser = Browser(self.marionette)
        self.browser.launch()

    def test_browser_search(self):
        search_text = 'Mozilla Web QA'

        self.wait_for_element_displayed(*self.browser._awesome_bar_locator)

        self.marionette.find_element(*self.browser._awesome_bar_locator).clear()
        self.browser.go_to_url(search_text)

        self.browser.switch_to_content()
        self.wait_for_element_displayed(*self._google_search_input_locator)
        self.assertTrue(search_text in self.marionette.title)
        self.assertEqual(search_text,
                         self.marionette.find_element(*self._google_search_input_locator).get_attribute('value'))

    def tearDown(self):
        GaiaMtbfTestCase.tearDown(self)
开发者ID:nhirata,项目名称:MTBF-Driver,代码行数:29,代码来源:test_mtbf_browser_search.py

示例3: test_cost_control_reset_wifi

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_cost_control_reset_wifi(self):

        self.data_layer.connect_to_wifi()
        cost_control = CostControl(self.marionette)
        cost_control.launch()
        cost_control.run_ftu_accepting_defaults()

        cost_control.toggle_mobile_data_tracking(False)
        cost_control.toggle_wifi_data_tracking(True)

        # open browser to get some data downloaded
        # please remove this once there is a better way than launching browser app/obj to do so
        browser = Browser(self.marionette)
        browser.launch()
        browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')
        browser.switch_to_content()
        self.wait_for_element_present(*self._page_title_locator)

        # go back to Cost Control
        cost_control.launch()
        # if we can't trigger any data usage, there must be something wrong
        self.assertNotEqual(cost_control.wifi_data_usage_figure, u'0.00 B', 'No data usage shown after browsing.')

        # disable wifi before reset data, wait for wifi to be closed, and switch back to the app
        self.data_layer.disable_wifi()
        time.sleep(1)
        cost_control.launch()

        # # go to settings section
        settings = cost_control.tap_settings()
        settings.reset_data_usage()
        settings.tap_done()

        # wait for usage to be refreshed
        self.wait_for_condition(lambda m: cost_control.wifi_data_usage_figure == u'0.00 B', message='Wifi usage did not reset back to 0.00 B')
开发者ID:malini,项目名称:gaia-ui-tests-1,代码行数:37,代码来源:test_cost_control_reset_wifi.py

示例4: test_browser_tabs

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_browser_tabs(self):
        """ Open a new tab.
        Using Wifi/LAN

        Open Browser.
        Open tab menu.
        Add a new tab.
        Assert that the new tab has opened.
        Load a website ( http://mozqa.com/data/firefox/layout/mozilla.html)
        Switch back to the first tab.
        """
        browser = Browser(self.marionette)
        browser.launch()

        # Open tab menu.
        browser.tap_tab_badge_button()

        # Add a new tab and load a website.
        browser.tap_add_new_tab_button()
        browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')
        browser.switch_to_content()
        self.wait_for_element_present(*self._page_title_locator)
        heading = self.marionette.find_element(*self._page_title_locator)
        self.assertEqual(heading.text, 'We believe that the internet should be public, open and accessible.')

        # Assert that the new tab has opened.
        browser.switch_to_chrome()
        self.assertEqual(browser.displayed_tabs_number, 2)
        # Assert that the displayed tabs number is equal with the actual number of opened tabs.
        self.assertEqual(browser.displayed_tabs_number, browser.tabs_count)

        # Switch back to the first tab.
        browser.tap_tab_badge_button()
        browser.tabs[0].tap_tab()
        self.assertTrue(browser.is_awesome_bar_visible)
开发者ID:eeejay,项目名称:gaia-ui-tests,代码行数:37,代码来源:test_browser_tabs.py

示例5: test_browser_tabs

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_browser_tabs(self):
        """ Open a new tab.
        Open Browser.
        Open tab menu.
        Add a new tab.
        Assert that the new tab has opened.
        Load a website.
        Switch back to the first tab.
        """
        browser = Browser(self.marionette)
        browser.launch()

        # Open tab menu.
        browser.tap_tab_badge_button()

        # Add a new tab and load a website.
        browser.tap_add_new_tab_button()
        browser.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

        # Assert that the new tab has opened.
        browser.switch_to_chrome()
        self.assertEqual(browser.displayed_tabs_number, 2)
        # Assert that the displayed tabs number is equal with the actual number of opened tabs.
        self.assertEqual(browser.displayed_tabs_number, browser.tabs_count)

        # Switch back to the first tab.
        browser.tap_tab_badge_button()
        browser.tabs[0].tap_tab()
        self.assertTrue(browser.is_awesome_bar_visible)
开发者ID:AkshayTiwari,项目名称:gaia,代码行数:33,代码来源:test_browser_tabs.py

示例6: test_browser_back_button

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_browser_back_button(self):
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url("http://mozqa.com/data/firefox/layout/mozilla.html")

        browser.switch_to_content()
        self.verify_home_page()

        community_link = self.marionette.find_element(*self._community_link_locator)
        # TODO: remove the explicit scroll once bug 833370 is fixed
        self.marionette.execute_script("arguments[0].scrollIntoView(false);", [community_link])
        community_link.tap()

        self.verify_community_page()
        browser.switch_to_chrome()
        browser.tap_back_button()

        browser.switch_to_content()
        self.verify_home_page()
        browser.switch_to_chrome()
        browser.tap_forward_button()

        browser.switch_to_content()
        self.verify_community_page()
开发者ID:EverythingMe,项目名称:gaia,代码行数:27,代码来源:test_browser_navigation.py

示例7: test_play_youtube_video

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_play_youtube_video(self):
        """ Confirm YouTube video playback

        https://moztrap.mozilla.org/manage/case/6073/

        """
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url(self.video_URL)
        browser.switch_to_content()

        # Tap the video
        self.wait_for_element_present(*self._video_container_locator)
        self.marionette.find_element(*self._video_container_locator).tap()
        # TODO: Remove sleep when Bug # 815115 is addressed, or if we can wait for a Javascript condition
        time.sleep(1)
        self.marionette.switch_to_frame()
        fullscreen_video = FullscreenVideo(self.marionette)

        # Switch to video player
        fullscreen_video.switch_to_video_frame()

        # Check for playback
        self.assertTrue(fullscreen_video.is_video_playing)
开发者ID:EdgarChen,项目名称:gaia-ui-tests,代码行数:27,代码来源:test_play_youtube_video.py

示例8: test_browser_back_button

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_browser_back_button(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/450
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')

        browser.switch_to_content()
        self.verify_home_page()

        community_link = self.marionette.find_element(*self._community_link_locator)
        community_link.tap()
        # # TODO: remove this execute_script when bug 833370 has been fixed
        # self.marionette.execute_script("arguments[0].scrollIntoView(false);", [community_link])
        # self.marionette.tap(community_link)

        self.verify_community_page()
        browser.switch_to_chrome()
        browser.tap_back_button()

        browser.switch_to_content()
        self.verify_home_page()
        browser.switch_to_chrome()
        browser.tap_forward_button()

        browser.switch_to_content()
        self.verify_community_page()
开发者ID:pcheng13,项目名称:gaia-ui-tests,代码行数:29,代码来源:test_browser_navigation.py

示例9: test_browser_bookmark

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_browser_bookmark(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/452
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')

        browser.tap_bookmark_button()
        browser.tap_add_bookmark_to_home_screen_choice_button()
        browser.type_bookmark_title(self.bookmark_title)
        browser.tap_add_bookmark_to_home_screen_dialog_button()

        # Switch to Home Screen to look for bookmark
        self.marionette.switch_to_frame()
        self.marionette.execute_script("window.wrappedJSObject.dispatchEvent(new Event('home'));")
        self.marionette.switch_to_frame(self.marionette.find_element(*self._homescreen_frame_locator))

        # Wait for Gaia to insert the element into the page
        self.wait_for_element_present(*self._homescreen_icon_locator)

        # check whether bookmark was added
        while self._homescreen_has_more_pages:
            if self.is_element_displayed(*self._homescreen_icon_locator):
                self._bookmark_added = True
                break
            self._go_to_next_page()

        self.assertTrue(self._bookmark_added, 'The bookmark %s was not found to be installed on the home screen.' % self.bookmark_title)
开发者ID:rwood-moz,项目名称:gaia-ui-tests,代码行数:30,代码来源:test_browser_bookmark.py

示例10: TestBrowserCellData

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
class TestBrowserCellData(GaiaMtbfTestCase):

    _page_title_locator = (By.ID, 'page-title')

    def setUp(self):
        GaiaMtbfTestCase.setUp(self)
        self.data_layer = GaiaData(self.marionette)
        self.data_layer.connect_to_cell_data()

        self.browser = Browser(self.marionette)
        self.browser.launch()

    def test_browser_cell_data(self):
        """https://moztrap.mozilla.org/manage/case/1328/"""
        self.wait_for_element_displayed(*self.browser._awesome_bar_locator)
        self.marionette.find_element(*self.browser._awesome_bar_locator).clear()

        self.browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html', timeout=120)
        self.browser.switch_to_content()

        self.wait_for_element_present(*self._page_title_locator, timeout=120)
        heading = self.marionette.find_element(*self._page_title_locator)
        self.assertEqual(heading.text, 'We believe that the internet should be public, open and accessible.')

    def tearDown(self):
        self.data_layer.disable_cell_data()
        GaiaMtbfTestCase.tearDown(self)
开发者ID:nhirata,项目名称:MTBF-Driver,代码行数:29,代码来源:test_mtbf_browser_cell_data.py

示例11: test_browser_lan

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
 def test_browser_lan(self):
     """https://moztrap.mozilla.org/manage/case/1327/"""
     browser = Browser(self.marionette)
     browser.launch()
     browser.go_to_url(self.test_url)
     browser.switch_to_content()
     Wait(self.marionette).until(lambda m: m.title == 'Mozilla')
开发者ID:AkshayTiwari,项目名称:gaia,代码行数:9,代码来源:test_browser_lan.py

示例12: prepare_app

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
 def prepare_app(self, app_name):
     if app_name.lower() == 'browser':
         from gaiatest.apps.browser.app import Browser
         browser = Browser(self.marionette)
         browser.go_to_url('http://taskjs.org/')
         tab_frame = self.marionette.execute_script("return window.wrappedJSObject.Browser.currentTab.dom;")
         self.marionette.switch_to_frame(tab_frame)
         MarionetteWait(self.marionette, 30).until(lambda m: m.execute_script('return window.document.readyState;', new_sandbox=False) == 'complete')
开发者ID:zbraniecki,项目名称:b2gperf,代码行数:10,代码来源:b2gperf.py

示例13: before_scroll

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
 def before_scroll(self):
     B2GPerfScrollTest.before_scroll(self)
     from gaiatest.apps.browser.app import Browser
     app = Browser(self.marionette)
     app.go_to_url('http://taskjs.org/')
     # TODO Move readyState wait into app object
     app.switch_to_content()
     MarionetteWait(self.marionette, 30).until(
         lambda m: m.execute_script(
             'return window.document.readyState;',
             new_sandbox=False) == 'complete')
开发者ID:changm,项目名称:b2gperf,代码行数:13,代码来源:b2gperf.py

示例14: TestBrowserBookmark

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
class TestBrowserBookmark(GaiaMtbfTestCase):

    _bookmark_added = False

    def setUp(self):
        GaiaMtbfTestCase.setUp(self)
        self.connect_to_network()

        self.test_url = 'http://mozqa.com/data/firefox/layout/mozilla.html'

        curr_time = repr(time.time()).replace('.', '')
        self.bookmark_title = 'gaia%s' % curr_time[10:]

        self.homescreen = Homescreen(self.marionette)
        self.browser = Browser(self.marionette)
        self.browser.launch()

    def test_browser_bookmark(self):
        self.wait_for_element_displayed(*self.browser._awesome_bar_locator)
        self.marionette.find_element(*self.browser._awesome_bar_locator).clear()

        self.browser.go_to_url(self.test_url)
        self.browser.tap_bookmark_button()

        bookmark = self.browser.tap_add_bookmark_to_home_screen_choice_button()
        self.wait_for_element_displayed(*bookmark._bookmark_title_input_locator)
        bookmark.type_bookmark_title(self.bookmark_title)
        bookmark.tap_add_bookmark_to_home_screen_dialog_button()

        # Switch to Home Screen to look for bookmark
        self.device.touch_home_button()

        self.wait_for_element_displayed('id', 'bookmark-title')
        self.homescreen.wait_for_app_icon_present(self.bookmark_title)
        self._bookmark_added = self.homescreen.is_app_installed(self.bookmark_title)
        if self.find_element('id', 'edit-button').is_displayed():
            self.find_element('id', 'edit-button').tap()

        self.assertTrue(self._bookmark_added, 'The bookmark %s was not found to be installed on the home screen.' % self.bookmark_title)

    def tearDown(self):
        # make sure it goes back to the top for activating editing mode
        self.device.touch_home_button()
        self.device.touch_home_button()

        # delete the bookmark
        self.apps.switch_to_displayed_app()
        self.homescreen.activate_edit_mode()
        self.confirm_dialog = self.homescreen.installed_app(self.bookmark_title).tap_delete_app()
        self.confirm_dialog.tap_confirm()

        self.data_layer.disable_wifi()
        GaiaMtbfTestCase.tearDown(self)
开发者ID:nhirata,项目名称:MTBF-Driver,代码行数:55,代码来源:test_mtbf_browser_bookmark.py

示例15: test_browser_lan

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import go_to_url [as 别名]
    def test_browser_lan(self):
        # https://moztrap.mozilla.org/manage/case/1327/
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')

        browser.switch_to_content()

        self.wait_for_element_present(*self._page_title_locator)
        heading = self.marionette.find_element(*self._page_title_locator)
        self.assertEqual(heading.text, 'We believe that the internet should be public, open and accessible.')
开发者ID:eeejay,项目名称:gaia-ui-tests,代码行数:14,代码来源:test_browser_lan.py


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