def _perform_search(self, term): self.marionette.find_element(*self._search_toggle_locator).tap() search_box = Wait(self.marionette).until( expected.element_present(*self._search_input_locator)) Wait(self.marionette).until(expected.element_displayed(search_box)) search_box.send_keys(term) search_box.send_keys(Keys.RETURN)
def gmail_login(self, user, passwd): email = Wait(self.marionette).until( expected.element_present(*self._email_locator)) Wait(self.marionette).until(expected.element_displayed(email)) email.tap() email.send_keys(user) password = self.marionette.find_element(*self._password_locator) password.tap() password.send_keys(passwd) self.keyboard.dismiss() self.marionette.find_element(*self._sign_in_locator).tap()
def a11y_connect_to_wifi(self, network_ssid, password, key_management=None): wifi_network = self.find_wifi_network(network_ssid) self.accessibility.click(wifi_network) # This is in the event we are using a Wifi Network that requires a password # We cannot be sure of this thus need the logic if key_management: password_element = Wait(self.marionette).until( expected.element_present(*self._password_input_locator)) Wait(self.marionette).until(expected.element_displayed(password_element)) password_element.send_keys(password) self.accessibility.click(self.marionette.find_element(*self._join_network_locator))
def enter_password(self, password=None): input = Wait(self.marionette, timeout=60).until( expected.element_present(*self._password_locator)) Wait(self.marionette).until(expected.element_displayed(input)) input.send_keys(password) # Wait until the keyboard is completely displayed, otherwise tapping # the next button is unreliable active_frame = self.marionette.get_active_frame() self.marionette.switch_to_frame() Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed) self.marionette.switch_to_frame(active_frame) self.marionette.find_element(*self._next_locator).tap()
def search(self, term): iframe = Wait(self.marionette).until( expected.element_present(*self._marketplace_iframe_locator)) Wait(self.marionette).until(expected.element_displayed(iframe)) self.marionette.switch_to_frame(iframe) search_box = Wait(self.marionette).until( expected.element_present(*self._search_locator)) Wait(self.marionette).until(expected.element_displayed(search_box)) # search for the app search_box.send_keys(term) search_box.send_keys(Keys.RETURN) return SearchResults(self.marionette)
def enter_password(self, password=None): input = Wait(self.marionette, timeout=60).until( expected.element_present(*self._password_locator)) Wait(self.marionette).until(expected.element_displayed(input)) input.send_keys(password) # Wait until the keyboard is completely displayed, otherwise tapping # the next button is unreliable active_frame = self.marionette.get_active_frame() self.marionette.switch_to_frame() Wait(self.marionette).until( lambda m: self.keyboard.is_keyboard_displayed) self.marionette.switch_to_frame(active_frame) self.marionette.find_element(*self._next_locator).tap()
def search(self, term): iframe = Wait(self.marionette).until( expected.element_present(*self._marketplace_iframe_locator)) Wait(self.marionette).until(expected.element_displayed(iframe)) self.marionette.switch_to_frame(iframe) search_box = Wait(self.marionette).until( expected.element_present(*self._search_locator)) Wait(self.marionette).until(expected.element_displayed(search_box)) # This sleep is necessary, otherwise the search results are not shown on desktop b2g import time time.sleep(0.5) # search for the app search_box.send_keys(term) search_box.send_keys(Keys.RETURN) return SearchResults(self.marionette)
def select_when_use_is_above_unit_and_value(self, unit, value): when_use_is_above_button = self.marionette.find_element(*self._when_use_is_above_button_locator) Wait(self.marionette).until(lambda m: when_use_is_above_button.get_attribute('disabled') == 'false') when_use_is_above_button.tap() current_unit = Wait(self.marionette).until( expected.element_present(*self._unit_button_locator)) Wait(self.marionette).until(expected.element_displayed(current_unit)) if current_unit.text != unit: current_unit.tap() # We need to wait for the javascript to do its stuff Wait(self.marionette).until(lambda m: current_unit.text == unit) # clear the original assigned value and set it to the new value size = Wait(self.marionette).until(expected.element_present(*self._size_input_locator)) Wait(self.marionette).until(expected.element_displayed(size)) size.clear() size.send_keys(value) self.marionette.find_element(*self._usage_done_button_locator).tap()
def enter_email(self, email=None): self.marionette.switch_to_frame() iframe = Wait(self.marionette, timeout=60).until( expected.element_present(*self._iframe_locator)) Wait(self.marionette).until(expected.element_displayed(iframe)) Wait(self.marionette, timeout=60).until(lambda m: iframe.get_attribute('data-url') != 'about:blank') self.marionette.switch_to_frame(iframe) input = Wait(self.marionette, timeout=60).until( expected.element_present(*self._input_locator)) Wait(self.marionette).until(expected.element_displayed(input)) input.send_keys(email) # Wait until the keyboard is completely displayed, otherwise tapping # the next button is unreliable self.marionette.switch_to_frame() Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed) self.marionette.switch_to_frame(iframe) self.marionette.find_element(*self._next_locator).tap()
def enter_email(self, email=None): self.marionette.switch_to_frame() iframe = Wait(self.marionette, timeout=60).until( expected.element_present(*self._iframe_locator)) Wait(self.marionette).until(expected.element_displayed(iframe)) Wait(self.marionette, timeout=60).until( lambda m: iframe.get_attribute('data-url') != 'about:blank') self.marionette.switch_to_frame(iframe) input = Wait(self.marionette, timeout=60).until( expected.element_present(*self._input_locator)) Wait(self.marionette).until(expected.element_displayed(input)) input.send_keys(email) # Wait until the keyboard is completely displayed, otherwise tapping # the next button is unreliable self.marionette.switch_to_frame() Wait(self.marionette).until( lambda m: self.keyboard.is_keyboard_displayed) self.marionette.switch_to_frame(iframe) self.marionette.find_element(*self._next_locator).tap()
def select_when_use_is_above_unit_and_value(self, unit, value): when_use_is_above_button = self.marionette.find_element( *self._when_use_is_above_button_locator) Wait(self.marionette).until(lambda m: when_use_is_above_button. get_attribute('disabled') == 'false') when_use_is_above_button.tap() current_unit = Wait(self.marionette).until( expected.element_present(*self._unit_button_locator)) Wait(self.marionette).until(expected.element_displayed(current_unit)) if current_unit.text != unit: current_unit.tap() # We need to wait for the javascript to do its stuff Wait(self.marionette).until(lambda m: current_unit.text == unit) # clear the original assigned value and set it to the new value size = Wait(self.marionette).until( expected.element_present(*self._size_input_locator)) Wait(self.marionette).until(expected.element_displayed(size)) size.clear() size.send_keys(value) self.marionette.find_element(*self._usage_done_button_locator).tap()