def login(self, username, password): SeleniumCore.wait_for_element_to_be_displayed(By.ID, LoginPage.USERNAME_FIELD) self.driver.find_elements_by_id( LoginPage.USERNAME_FIELD)[1].send_keys(username) self.driver.find_elements_by_id( LoginPage.PASSWORD_FIELD)[1].send_keys(password) self.driver.find_elements_by_name(LoginPage.LOGIN_BUTTON)[1].click()
def get_no_of_periods(self, periods): table = SeleniumCore.wait_for_element_to_be_displayed( By.ID, "ResultsTable") rows = table.find_elements_by_tag_name("tr") for i in range(1, len(rows)): cols = rows[i].find_elements_by_tag_name("td") periods.append(cols[2].text) return periods
def get_question_code_row_details(self, table_name, question): table = SeleniumCore.wait_for_element_to_be_displayed( By.ID, table_name) rows = table.find_elements_by_tag_name("tr") # Ignore the first row for i in range(1, len(rows)): cols = rows[i].find_elements_by_tag_name("td") # Check to see if the question code matches if cols[0].text == question: return rows[i]
def select_the_form_row(self, reference, period, sic_code): table = SeleniumCore.wait_for_element_to_be_displayed( By.ID, "ResultsTable") rows = table.find_elements_by_tag_name("tr") # Ignore the first row for i in range(1, len(rows)): cols = rows[i].find_elements_by_tag_name("td") # Check to see the sic code exists if sic_code: ReportingHelper.check_single_message_matches( reference, cols[i + 6].text, sic_code) # Check to see if any references appear that shouldn't be there if cols[1].text == reference and cols[2].text == period: view_form = rows[i].find_elements_by_tag_name("button") SeleniumCore.select_view_form(view_form[0]) break
def current_page_title(self): element = SeleniumCore.wait_for_element_to_be_displayed(By.XPATH, "//div[contains(@class,'header__title')]") return element.text