def set_prev_page(self) -> MainPage: footer = self._driver.find_elements(By.CSS_SELECTOR, Paging.PAGING_LINKS) for element in footer: paging_link = Link(Control(element)) if '<' in paging_link.get_text(): paging_link.click() return MainPage(self._driver)
def _next_page_exists(self): footer = self._driver.find_elements(By.CSS_SELECTOR, Paging.PAGING_LINKS) paging_link = Link(Control(footer[-1])) if '>' in paging_link.get_text(): return True else: return False
def click_select_all_categories(self): Button(Control(self._driver.find_element(By.NAME, Comment.SELECT_ALL_CAT_BTN))).click() return self
def uncheck_active_status_checkbox(self): active_status = CheckBox(Control(self._driver.find_element(By.CSS_SELECTOR, Comment.ACTIVE))) if active_status.is_checked(): active_status.check() return self
def edit_comment_number(self, text: str): TextInput(Control(self._driver.find_element(By.ID, Comment.EDIT_NUMBER))).type(text) return self
def input_comment_number(self, text: str): comment_number = TextInput(Control(self._driver.find_element(By.ID, Comment.EDIT_NUMBER))) comment_number.clear() comment_number.type(text) return self
def edit_comment_text(self, text: str): TextInput(Control(self._driver.find_element(By.ID, Comment.EDIT_TEXT)))\ .type(text) return self
def input_comment_text(self, text: str): comment_text = TextInput(Control(self._driver.find_element(By.ID, Comment.EDIT_TEXT))) comment_text.clear() comment_text.type(text) return self
def click_save_and_return_button(self): Button(Control(self._driver.find_element(By.CSS_SELECTOR, Comment.SAVE_RETURN_BTN))).click() return main_page.MainPage(self._driver)
def click_save_button(self): Button(Control(self._driver.find_element(By.CSS_SELECTOR, Comment.SAVE_BTN))).click() return self
def click_delete_button(self) -> DialogMenu: Button( Control(self._driver.find_element(By.CSS_SELECTOR, Main.DELETE_BTN))).click() return DialogMenu(self._driver)
def click_edit_button(self) -> CommentDetailsPage: Button( Control(self._driver.find_element(By.CSS_SELECTOR, Main.EDIT_BTN))).click() return CommentDetailsPage(self._driver)
def click_new_button(self) -> CommentDetailsPage: Button(Control(self._driver.find_element(By.ID, Main.NEW_BTN))).click() return CommentDetailsPage(self._driver)
def cancel(self) -> MainPage: Button( Control(self._driver.find_element(By.CSS_SELECTOR, Dialog.NO_BTN))).click() return MainPage(self._driver)
def select_comment_by_number(self, number: int) -> MainPage: CheckBox(Control(self._driver.find_element( By.XPATH, CommSelectors.COMMENT_CHECKBOX_BY_ROW\ .format(row_num=number)))).check() return MainPage(self._driver)
def apply_filter(self): Button(Control(self._driver.find_element(By.ID, Filter.APPLY_BTN))).click() return MainPage(self._driver)