Created
May 15, 2018 21:24
-
-
Save TriplEight/abb31daef581589536b2226ee9393171 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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