from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
def get_element(self, path_type, element_path, custom_time_out=None,):
    """
    :param path_type: тип локатора
    :param element_path: путь элемента
    :return:
    """
    __type = {
        'xpath': By.XPATH,
        'css': By.CSS_SELECTOR,
        'id': By.ID,
        'class': By.CLASS_NAME
    }
    if custom_time_out is not None:
        time_out = custom_time_out
    else:
        time_out = self.time_out
    return WebDriverWait(self.driver, time_out).until(expected_conditions.presence_of_element_located((__type.get(path_type), element_path)))