Я пытаюсь отделить мои локаторы от классов объектов страницы. И это прекрасно работает с driver.find_element. Но если я пытаюсь использовать его с EC, как self.wait.until(EC.visibility_of_element_located(*OrderLocators.file_upload_in_process))
Я получаю эту ошибку
File "C:\FilePath\ClabtFirstForm.py", line 95, in wait_for_file_upload
wait.until(EC.visibility_of_element_located(*OrderLocators.file_upload_in_process))
TypeError: __init__() takes 2 positional arguments but 3 were given
Мой метод испытаний
def test_files_regular(self):
project_path = get_project_path()
file = project_path + "\Data\Media\doc_15mb.doc"
self.order.button_upload_files()
self.order.button_select_files(file)
self.order.wait_for_file_upload()
Класс объекта страницы
class CreateOrder(object):
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(driver, 25)
def button_upload_files(self):
self.driver.find_element(*OrderLocators.button_upload_files).click()
def button_select_files(self, file):
self.driver.find_element(*OrderLocators.button_select_files).send_keys(file)
def wait_for_file_upload(self):
self.wait.until(EC.visibility_of_element_located(*OrderLocators.file_upload_in_process))
self.wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "[ng-show='item.isSuccess']")))
локаторы
class OrderLocators(object):
button_upload_files = (By.CLASS_NAME, 'file-upload-label')
button_select_files = (By.CLASS_NAME, 'input-file')
file_upload_in_process = (By.CSS_SELECTOR, "[ng-show='item.isUploading']")