Page Object Models

Page Object Models provide methods to interact with the pages they represent for instance using the Data Entry Page Object Model provides methods to fill out the observation form.

All Mobile Page Object Models are subclasses of BaseMobilePage which provides methods for going to the various mobile pages as well as common interaction patterns such as clicking a button and waiting for a particular element to become visible/invisible to verify the intended action has worked.

Common Methods:

class liveobs_ui.page_object_models.common.base_liveobs_page.BaseLiveObsPage(driver)[source]

Base Page for all LiveObs Interaction

click_and_verify_change(el_to_click, el_to_verify, hidden=False)[source]

Wrapper around clicking an element and then waiting for a change in the page and verifying said change by ensuring an element is visible

Parameters:
  • el_to_click – Element to click to induce change
  • el_to_verify – Element to look for to verify change
  • hidden – Should check for if element is now hidden or not
static element_is_displayed(element_object)[source]

Verify that an element is visible on the page

Parameters:element_object – the object or element to verify
Returns:either True/False for the element being displayed
enter_input_value(element, value, autocompleted=False, dropdown=False)[source]

Enter a value into an input field

Parameters:
  • element – webelement we want to add value to
  • value – Value we want to add
  • autocompleted – If should wait for autocomplete box to show before continuing
  • dropdown – If should wait for the different type of dropdown to show before continuing
enter_many2one_tag_value(element, value)[source]

Add value to many2one tag input then verify that the tag has been added

Parameters:
  • element – many2one tag input element
  • value – value to add to the many2one input
fill_input_field(element, value)[source]

Enter a value into an input field

Parameters:
  • element – webelement we want to add value to
  • value – Value to enter into input
fill_out_form(data)[source]

Using the provided list fill out the form

Expected Data Format:

{
    'name': 'respiration_rate',
    'value': '18',
    'type': 'textbox'
}
Parameters:data – list of dictionaries that contain field names, value to enter and field type
fill_select_field(element, value)[source]

Select an option in a select field

Parameters:
  • element – Select we want to sort out’s webelement
  • value – Value to select in the select field
get_element_by_lookup(element_name)[source]

Get an element by the lookup :param element_name: look up term to match :return: webelement

static get_locator(element)[source]

Get locator for element

Parameters:element – webelement we want to generate locator for
Returns:Locator for supplied element
static get_state_of_el(element, attribute, state)[source]

Return if attribute on element is a particular state :param element: Webelement :param attribute: attribute to find :param state: expected value :return: bool

verify_page_loaded(app_view)[source]

Waits for a specific element to be visible on the screen the ‘desktop’ or ‘mobile’ app to ensure the page has loaded before progressing

Parameters:app_view – Either ‘mobile’ or ‘desktop’
wait_for_element(element_selector, hidden=False, wait_time=None)[source]

Wrapper around WebDriverWait to wait for specified element to become visible

Parameters:
  • element_selector (tuple) – Element Selector tuple
  • hidden (bool) – Check if element is hidden or not
  • wait_time (int) – Custom time to wait