Skip to content

Instantly share code, notes, and snippets.

@TriplEight
Created May 15, 2018 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TriplEight/abb31daef581589536b2226ee9393171 to your computer and use it in GitHub Desktop.
Save TriplEight/abb31daef581589536b2226ee9393171 to your computer and use it in GitHub Desktop.
from selenium.webdriver.support import expected_conditions as EC
class AbstractPage(BasePage):
def find_element_in_table(self, search_by, table_x, column_header_x, is_clickable=False):
"""
Возвращает элемент таблицы :param table_x, найденный по пересечению ряда и столбца.
:param is_clickable:
:param search_by: уникальное значение (id, name) в таблице, нужно для определения ряда
:param table_x: XPATH таблицы
:param column_header_x: XPATH колонки, значение которой нужно
:return: Element
"""
search_row = table_x + '//*[text()[normalize-space(.) = "{}" ]]/parent::tr'.format(search_by)
search_cell = search_row + column_header_x
if is_clickable:
ec = EC.element_to_be_clickable
else:
ec = EC.visibility_of_element_located
# FIXME: crutch
WebDriverWait(self._driver, 5)
return WebDriverWait(self._driver, WEB_DRIVER_WAIT).until(
ec((By.XPATH, search_cell)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment