def get_element_by_lookup(self, element_name): """ Get an element by the lookup :param element_name: look up term to match :return: webelement """ return self.driver.find_element(*get_element_selector(element_name))
def find_button_to_select(self, button_name): """ Find a button in the page by name :return: the button element on the page """ button_selector = get_element_selector(button_name) button_element = self.driver.find_element(*button_selector) return button_element
def verify_obs_field_not_displayed(self, obs_field): """ Locate a specific field in an observation form and verifies it is not visible :param obs_field: the observation field to look for """ field_selector = get_element_selector(obs_field) obs_fields = self.driver.find_element(*field_selector) return not self.element_is_displayed(obs_fields)
def get_clinical_risk_in_popup(self, cli_risk_expected): """ Locates and returns the risk from an observation in the confirmation popup :param cli_risk_expected: value expected to be returned :return: string in specified element """ element_locator = get_element_selector(cli_risk_expected) popup_element = self.driver.find_element(*element_locator) if popup_element: return popup_element.text
def verify_obs_form_displayed(self, obs_type): """ Finds the data-type attribute for the currently open observation form and compares the result to the expected data-type as per the obs_type selected :param obs_type: the observation selected """ obs_form = self.driver.find_element_by_id('obsForm') self.element_is_displayed(obs_form) return self.get_data_model_from_form() == \ get_element_selector(obs_type)
def input_value_in_field(context, value, input_type, input_field): """ Inputs or selects a specified value into a field :param context: behave context :param value: a value/option to input/select :param input_type: either input or select field :param input_field: name of field to locate """ field_selector = get_element_selector(input_field) obs_page = DataEntryPage(context.driver) field_input = context.driver.find_element(*field_selector) field_locator = obs_page.locate_attribute_path(field_input) if input_type == 'inputted': obs_page.fill_input_field(field_locator, value) elif input_type == 'selected': obs_page.fill_select_field(field_locator, value)