本文整理汇总了Python中marionette_driver.expected.element_not_present函数的典型用法代码示例。如果您正苦于以下问题:Python element_not_present函数的具体用法?Python element_not_present怎么用?Python element_not_present使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了element_not_present函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_certificate
def test_no_certificate(self):
with self.marionette.using_context("content"):
self.marionette.navigate(self.url)
# Check the favicon
# TODO: find a better way to check, e.g., mozmill's isDisplayed
favicon_hidden = self.marionette.execute_script(
"""
return arguments[0].hasAttribute("hidden");
""",
script_args=[self.browser.navbar.locationbar.identity_icon],
)
self.assertFalse(favicon_hidden, "The identity icon is visible")
# Check that the identity box organization label is blank
self.assertEqual(
self.locationbar.identity_organization_label.get_attribute("value"), "", "The organization has no label"
)
# Open the identity popup
self.locationbar.open_identity_popup()
# Check the idenity popup doorhanger
self.assertEqual(self.identity_popup.element.get_attribute("connection"), "not-secure")
# The expander for the security view does not exist
expected.element_not_present(lambda m: self.identity_popup.main.expander)
# Only the insecure label is visible
secure_label = self.identity_popup.view.main.secure_connection_label
self.assertEqual(secure_label.value_of_css_property("display"), "none")
insecure_label = self.identity_popup.view.main.insecure_connection_label
self.assertNotEqual(insecure_label.value_of_css_property("display"), "none")
self.identity_popup.view.main.expander.click()
Wait(self.marionette).until(lambda _: self.identity_popup.view.security.selected)
# Open the Page Info window by clicking the "More Information" button
page_info = self.browser.open_page_info_window(
lambda _: self.identity_popup.view.security.more_info_button.click()
)
# Verify that the current panel is the security panel
self.assertEqual(page_info.deck.selected_panel, page_info.deck.security)
# Check the domain listed on the security panel contains the url's host name
self.assertIn(urlparse(self.url).hostname, page_info.deck.security.domain.get_attribute("value"))
# Check the owner label equals localized 'securityNoOwner'
self.assertEqual(
page_info.deck.security.owner.get_attribute("value"), page_info.get_property("securityNoOwner")
)
# Check the verifier label equals localized 'notset'
self.assertEqual(page_info.deck.security.verifier.get_attribute("value"), page_info.get_property("notset"))
示例2: close_app
def close_app(self, app):
self.wait_for_card_ready(app)
Wait(self.marionette).until(
expected.element_present(*self._app_card_locator(app)))
self.marionette.find_element(*self._close_button_locator(app)).tap()
Wait(self.marionette).until(
expected.element_not_present(*self._app_card_locator(app)))
示例3: tap_edit_done
def tap_edit_done(self):
element = self.marionette.find_element(*self._exit_edit_mode_locator)
Wait(self.marionette).until(lambda m: element.is_displayed())
element.tap()
Wait(self.marionette).until(lambda m: not element.is_displayed())
Wait(self.marionette).until(expected.element_not_present(
*self._edit_mode_locator))
示例4: tap_send
def tap_send(self, timeout=120):
send = Wait(self.marionette).until(
expected.element_present(*self._send_message_button_locator))
Wait(self.marionette).until(expected.element_enabled(send))
send.tap()
Wait(self.marionette, timeout=timeout).until(
expected.element_not_present(*self._message_sending_locator))
from gaiatest.apps.messages.regions.message_thread import MessageThread
return MessageThread(self.marionette)
示例5: test_buttons
def test_buttons(self):
self.marionette.set_context('content')
# Load initial web page
self.marionette.navigate(self.url)
Wait(self.marionette).until(expected.element_present(lambda m:
m.find_element(By.ID, 'mozilla_logo')))
with self.marionette.using_context('chrome'):
# Both buttons are disabled
self.assertFalse(self.navbar.back_button.is_enabled())
self.assertFalse(self.navbar.forward_button.is_enabled())
# Go to the homepage
self.navbar.home_button.click()
Wait(self.marionette).until(expected.element_not_present(lambda m:
m.find_element(By.ID, 'mozilla_logo')))
self.assertEqual(self.marionette.get_url(), self.browser.default_homepage)
with self.marionette.using_context('chrome'):
# Only back button is enabled
self.assertTrue(self.navbar.back_button.is_enabled())
self.assertFalse(self.navbar.forward_button.is_enabled())
# Navigate back
self.navbar.back_button.click()
Wait(self.marionette).until(expected.element_present(lambda m:
m.find_element(By.ID, 'mozilla_logo')))
self.assertEqual(self.marionette.get_url(), self.url)
with self.marionette.using_context('chrome'):
# Only forward button is enabled
self.assertFalse(self.navbar.back_button.is_enabled())
self.assertTrue(self.navbar.forward_button.is_enabled())
# Navigate forward
self.navbar.forward_button.click()
Wait(self.marionette).until(expected.element_not_present(lambda m:
m.find_element(By.ID, 'mozilla_logo')))
self.assertEqual(self.marionette.get_url(), self.browser.default_homepage)
示例6: login
def login(self, email, password):
# This only supports logging in with a known user and no existing session
self.type_email(email)
self.tap_continue()
self.type_password(password)
self.tap_returning()
self.marionette.switch_to_frame()
Wait(self.marionette).until(
expected.element_not_present(*self._persona_frame_locator))
self.apps.switch_to_displayed_app()
示例7: close_test_container
def close_test_container(self):
self.marionette.set_context(self.marionette.CONTEXT_CONTENT)
result = self.marionette.execute_async_script(
"""
if((navigator.mozSettings == undefined) || (navigator.mozSettings == null) || (navigator.mozApps == undefined) || (navigator.mozApps == null)) {
marionetteScriptFinished(false);
return;
}
let setReq = navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
setReq.onsuccess = function() {
let appsReq = navigator.mozApps.mgmt.getAll();
appsReq.onsuccess = function() {
let apps = appsReq.result;
for (let i = 0; i < apps.length; i++) {
let app = apps[i];
if (app.manifest.name === 'Test Container') {
let manager = window.wrappedJSObject.appWindowManager || window.wrappedJSObject.AppWindowManager;
if (!manager) {
marionetteScriptFinished(false);
return;
}
manager.kill(app.origin);
marionetteScriptFinished(true);
return;
}
}
marionetteScriptFinished(false);
}
appsReq.onerror = function() {
marionetteScriptFinished(false);
}
}
setReq.onerror = function() {
marionetteScriptFinished(false);
}""",
script_timeout=60000,
)
if not result:
raise Exception("Failed to close Test Container app")
Wait(self.marionette, timeout=10, interval=0.2).until(
element_not_present("css selector", 'iframe[src*="app://test-container.gaiamobile.org/index.html"]')
)
示例8: wait_for_element_not_present
def wait_for_element_not_present(self, by, locator):
Wait(self.marionette).until(expected.element_not_present(by, locator))
示例9: test_element_not_present_is_present
def test_element_not_present_is_present(self):
self.marionette.navigate(static_element)
r = expected.element_not_present(p)(self.marionette)
self.assertIsInstance(r, bool)
self.assertFalse(r)
示例10: test_element_not_present_locator
def test_element_not_present_locator(self):
r = expected.element_not_present(By.ID, "nosuchelement")(self.marionette)
self.assertIsInstance(r, bool)
self.assertTrue(r)
示例11: test_element_not_present_func
def test_element_not_present_func(self):
r = expected.element_not_present(no_such_element)(self.marionette)
self.assertIsInstance(r, bool)
self.assertTrue(r)
示例12: hang_up
def hang_up(self):
self.marionette.find_element(*self._hangup_bar_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(
expected.element_not_present(*self._call_screen_locator))