本文整理汇总了Python中OWDTestToolkit.apps.browser.Browser类的典型用法代码示例。如果您正苦于以下问题:Python Browser类的具体用法?Python Browser怎么用?Python Browser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Browser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.testURL = self.UTILS.general.get_config_variable("test_url", "common")
self.UTILS.reporting.logComment("Using " + self.testURL)
# switch off keyboard FTU screen
self.data_layer.set_setting("keyboard.ftu.enabled", False)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Wifi needs to be off for this test to work.
self.data_layer.connect_to_cell_data()
# Open the browser app.
self.browser.launch()
# Open our URL.
self.browser.open_url(self.testURL)
示例2: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.test.test(not self.UTILS.network.is_network_type_enabled("data"),
"Data mode is disabled before we start this test.")
self.UTILS.statusbar.toggleViaStatusBar("data")
self.wait_for_condition(lambda m: self.data_layer.is_cell_data_connected,
timeout=20, message="Device attached to data connection")
self.browser.launch()
self.browser.open_url("http://www.google.com")
self.UTILS.statusbar.toggleViaStatusBar("data")
self.wait_for_condition(lambda m: not self.data_layer.is_cell_data_connected,
timeout=20, message="Device attached to data connection")
self.UTILS.element.waitForNotElements(DOM.Statusbar.dataConn, "Data icon in statusbar")
示例3: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.video = Video(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "clipcanvas_14348_H264_320x180.mp4"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
self.connect_to_network()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=120)
示例4: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.settings = Settings(self)
self.browser = Browser(self)
self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi")
self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi")
self.testURL = self.UTILS.general.get_config_variable("test_url", "common")
self.apps.set_permission_by_url(Browser.search_manifest_url, 'geolocation', 'deny')
# switch off keyboard FTU screen
self.data_layer.set_setting("keyboard.ftu.enabled", False)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Open the settings application.
self.settings.launch()
# Connect to the wifi.
self.settings.wifi()
self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass)
# Open the browser app.
self.browser.launch()
# Open our URL.
self.browser.open_url(self.testURL)
示例5: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi")
self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi")
self.data_layer.connect_to_wifi()
self.data_layer.is_wifi_connected()
self.apps.kill_all()
self.url = "https://acperez.github.io/gecko-sw-test/"
self.sw_scope = "https://acperez.github.io/gecko-sw-test/"
self.sw_header = "https://acperez.github.io!appId=22&inBrowser=1"
self.script_spec = "https://acperez.github.io/gecko-sw-test/service-worker.js"
def tearDown(self):
self.data_layer.disable_wifi()
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.browser.launch()
self.browser.open_url(self.url)
register_btn = self.UTILS.element.getElement(dom.acperez_register_btn_dom, "Register Worker button")
register_btn.tap()
self.settings.launch()
time.sleep(2)
self.settings.developer_settings()
time.sleep(2)
self.settings.service_workers_menu()
div_dom = (DOM.Settings.service_worker_div[0], DOM.Settings.service_worker_div[1].format(self.sw_scope))
div_elem = self.UTILS.element.getElement(div_dom, "Service worker div")
self.UTILS.element.scroll_into_view(div_elem)
header = div_elem.find_element(*DOM.Settings.service_worker_header)
self.UTILS.test.test(header.text == self.sw_header, "Header found [{}] Expected [{}]".
format(header.text, self.sw_header))
scope = div_elem.find_element(*DOM.Settings.service_worker_scope)
self.UTILS.test.test(self.sw_scope == scope.text, "Scope found [{}] Expected [{}]".
format(scope.text, self.sw_scope))
script_spec = div_elem.find_element(*DOM.Settings.service_worker_script_spec)
self.UTILS.test.test(self.script_spec == script_spec.text, "Script spec found [{}] Expected [{}]".
format(script_spec.text, self.script_spec))
worker_url = div_elem.find_element(*DOM.Settings.service_worker_current_url)
self.UTILS.test.test(self.script_spec == worker_url.text, "URL found [{}] Expected [{}]".
format(worker_url.text, self.script_spec))
unregister_btn = div_elem.find_element(*DOM.Settings.service_worker_unregister_btn)
unregister_btn.tap()
示例6: test_main
class test_main(GaiaTestCase):
button_locator = ('css selector', "button.icon")
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "clipcanvas_14348_H264_320x180.mp4"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
self.connect_to_network()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
self.apps.kill_all()
time.sleep(2)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60)
time.sleep(3)
self.settings.launch()
self.settings.downloads()
self.download_manager.open_download(self.data_url)
share_option = self.UTILS.element.getElement(DOM.DownloadManager.download_file_option_share,
"Getting Share option button")
share_option.tap()
self.marionette.switch_to_frame()
share_menu = self.UTILS.element.getElement(DOM.GLOBAL.action_menu, "Share menu")
options = share_menu.find_elements(*self.button_locator)
self.UTILS.test.test(len(options) > 0, "A list with several options to share is shown")
self._show_option(options)
def _show_option(self, options):
for option in options:
self.UTILS.reporting.logResult('info', "Share option: {}".format(option.text))
示例7: test_main
class test_main(GaiaTestCase):
links = ["www.google.com", "www.hotmail.com", "www.wikipedia.org"]
test_msg = "Test " + " ".join(links) + " this."
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.browser = Browser(self)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.connect_to_network()
# Create and send a new test message.
self.data_layer.send_sms(self.phone_number, self.test_msg)
self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
map(self.try_link, range(len(self.links)), self.links)
def try_link(self, link_number, link):
self.UTILS.reporting.logResult("info", "Tapping <b>{}</b> ...".format(link))
# Switch to messaging app.
self.messages.launch()
self.messages.openThread(self.phone_number)
time.sleep(1)
# Get last message.
msg = self.messages.last_message_in_this_thread()
# Find all URLs
l = msg.find_element("xpath", "//a[text()='{}']".format(link))
# Tap on required link.
self.UTILS.element.simulateClick(l)
self.marionette.switch_to_frame()
self.browser.wait_for_page_to_load()
self.UTILS.test.test(
link in self.browser.loaded_url(), "Web page loaded #{} correctly.".format(link_number + 1))
示例8: test_main
class test_main(GaiaTestCase):
test_url = "http://everlong.org/mozilla/packaged/"
_appName = "cool packaged app"
_appOK = True
install_button_locator = ('id', 'install-app')
confirm_install_locator = ('id', 'app-install-install-button')
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.settings = Settings(self)
self.browser = Browser(self)
self.connect_to_network()
# Uninstall the app (if need be).
self.UTILS.app.uninstallApp(self._appName)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.browser.launch()
self.browser.open_url(self.test_url)
"""
Install the app (these DOM items are peculiar to this little dev app,
so dont bother putting them in the main DOM.py file).
"""
install_btn = self.UTILS.element.getElement(self.install_button_locator, "Install an app button")
install_btn.tap()
# Install button on the splash screen (switch to main frame to 'see' this).
self.marionette.switch_to_frame()
install_btn = self.UTILS.element.getElement(self.confirm_install_locator, "Install button", True, 30)
install_btn.tap()
ok_btn = self.UTILS.element.getElement(DOM.GLOBAL.modal_dialog_alert_ok, "Ok button")
ok_btn.tap()
expected_msg = "{} installed".format(self._appName)
system_banner = self.UTILS.element.getElement(DOM.GLOBAL.system_banner, "System notification banner")
self.UTILS.test.test(system_banner.text == expected_msg, "Banner matches expected message")
self.apps.kill_all()
time.sleep(2)
# Go back to the home page and check the app is installed.
self.UTILS.test.test(self.UTILS.app.launchAppViaHomescreen(self._appName),
"Application '" + self._appName + "' can be launched from the homescreen.", True)
示例9: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "1GB.rar"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
# make the download process slower
self.data_layer.connect_to_cell_data()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading",
timeout=15)
time.sleep(5)
self.apps.kill_all()
time.sleep(2)
self.settings.launch()
self.settings.downloads()
# Verify status downloading using data-state="downloading".
self.download_manager.verify_download_status(self.data_url, "downloading")
download_info = self.download_manager.get_download_info(self.data_url)
match = re.search(r"(\d)+(.(\d)+)*\s(GB|MB|KB)\sof\s(\d)+(.(\d)+)*\sGB$", download_info.text)
self.UTILS.test.test(match is not None, "Verify the the text is: 'X' GB of 'Y' GB")
time.sleep(3)
self.download_manager.stop_download(self.data_url, True)
示例10: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "41MB.rar"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
self.data_layer.connect_to_cell_data()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading", timeout=15)
self.apps.kill_all()
time.sleep(2)
self.settings.launch()
self.settings.downloads()
# Verify status downloading using data-state="downloading".
self.download_manager.verify_download_status(self.data_url, "downloading")
self.download_manager.verify_download_graphical_status(self.data_url, "downloading")
self.UTILS.home.touchHomeButton()
self.UTILS.statusbar.displayStatusBar()
self.UTILS.statusbar.wait_for_notification_statusbar_title("Downloading")
self.UTILS.statusbar.hideStatusBar()
self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=240)
示例11: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "11MB.rar"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
self.connect_to_network()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60)
time.sleep(5)
self.apps.kill_all()
time.sleep(2)
previous_number_of_pictures = len(self.data_layer.sdcard_files())
self.settings.launch()
self.settings.downloads()
self.download_manager.open_download(self.data_url)
self.download_manager.open_download_delete_file()
elem = (DOM.DownloadManager.download_element[0],
DOM.DownloadManager.download_element[1].format(self.data_url))
self.UTILS.element.waitForNotElements(elem, "Download is not there")
# Check that picture saved to SD card
self.wait_for_condition(
lambda m: len(self.data_layer.sdcard_files()) == previous_number_of_pictures - 1, 20)
self.assertEqual(len(self.data_layer.sdcard_files()), previous_number_of_pictures - 1)
示例12: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "105MB.rar"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
# make the download process slower
self.data_layer.connect_to_cell_data()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading", timeout=15)
time.sleep(5)
self.apps.kill_all()
time.sleep(2)
self.settings.launch()
self.settings.downloads()
# Verify status downloading using data-state="downloading".
self.download_manager.verify_download_status(self.data_url, "downloading")
self.download_manager.verify_download_graphical_status(self.data_url, "downloading")
self.download_manager.stop_download(self.data_url, True)
is_there = self.UTILS.statusbar.isIconInStatusBar(DOM.Statusbar.downloads)
self.UTILS.test.test(not is_there, "Verify that the download icon in status bar is dismissed")
示例13: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
self.file_name = "Crazy_Horse.jpg"
self.data_url = "{}/{}".format(self.test_url, self.file_name)
self.connect_to_network()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.test_url)
self.download_manager.download_file(self.file_name)
self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60)
time.sleep(5)
self.apps.kill_all()
time.sleep(2)
self.settings.launch()
self.settings.downloads()
self.download_manager.open_download(self.data_url)
self.download_manager.tap_on_open_option()
# Verify that the image is opened.
self.UTILS.iframe.switchToFrame(*DOM.Gallery.frame_locator)
title = self.UTILS.element.getElement(DOM.Gallery.file_name_header, "File name header")
self.UTILS.test.test(title.text == self.file_name, "File name matches in Gallery")
is_loaded = self.UTILS.element.waitForElements(DOM.Gallery.current_image_pic,
"Waiting for image to be loaded")
self.UTILS.test.test(is_loaded, "Image has been loaded")
示例14: test_main
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
# Specific for this test.
self.browser = Browser(self)
self.settings = Settings(self)
self.download_manager = DownloadManager(self)
self.testURL = self.UTILS.general.get_config_variable("download_url", "common")
self.file_names = ["Toast.doc", "Porridge.doc"]
self.connect_to_network()
self.settings.launch()
self.settings.downloads()
self.download_manager.clean_downloads_list()
self.apps.kill_all()
time.sleep(2)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.browser.launch()
self.browser.open_url(self.testURL)
map(self.download_manager.download_file, self.file_names)
self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60)
time.sleep(5)
previous_number_of_pictures = len(self.data_layer.sdcard_files())
self.settings.launch()
self.settings.downloads()
# Delete All downloads
self.download_manager.delete_all_downloads()
# Check that picture saved to SD card
self.wait_for_condition(
lambda m: len(self.data_layer.sdcard_files()) == previous_number_of_pictures - len(self.file_names), 20)
self.assertEqual(len(self.data_layer.sdcard_files()), previous_number_of_pictures - len(self.file_names))
示例15: test_main
class test_main(GaiaTestCase):
link = "www.google.com"
test_msg = "Test " + link + " this."
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.browser = Browser(self)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.connect_to_network()
# Launch messages app.
self.messages.launch()
# Create and send a new test message.
self.messages.create_and_send_sms([self.phone_number], self.test_msg)
"""
Wait for the last message in this thread to be a 'received' one
and click the link.
"""
x = self.messages.wait_for_message()
self.UTILS.test.test(x, "Received a message.", True)
x.find_element("tag name", "a").tap()
"""
Give the browser time to start up, then
switch to the browser frame and check the page loaded.
"""
self.marionette.switch_to_frame()
self.browser.wait_for_page_to_load()
self.UTILS.test.test(
self.link in self.browser.loaded_url(), "Web page loaded ({}) correctly.".format(self.link))