Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
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)))
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(self.driver, 10)
element = wait.until(EC.element_to_be_clickable(
(By.CLASS_NAME, 'some class')))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question