Python Selenium Webdriver Wait.Until shows that the error takes exactly 2 arguments 3

I am using Python Webdriver. I'm having trouble clicking the Add button. I am using Webdriver Wait, I get the following error when running my code.

Traceback (most recent call last):
File "C:\Webdriver\ClearCore 501\TestCases\AdministrationPage_TestCase.py", line 164, in test_add_Project
administration_page.add_project(project_name)
File "C:\Webdriver\ClearCore 501\Pages\admin.py", line 63, in add_project
element = wait.until(EC.element_to_be_clickable(By.XPATH, '//span[@class="gwt-InlineLabel" and contains(text(), "Projects")]/following-sibling::*/div[@class="gwt-HTML" and contains(text(), "Add...")]'))
TypeError: __init__() takes exactly 2 arguments (3 given)

My webdriver code

wait = WebDriverWait(self.driver, 60)
element = wait.until(EC.element_to_be_clickable(By.XPATH, '//span[@class="gwt-InlineLabel" and contains(text(), "Projects")]/following-sibling::*/div[@class="gwt-HTML" and contains(text(), "Add...")]'))
element.click()

What am I doing wrong? Xpath is valid as I tested it in Firefox, Firepath. He finds a button.

+4
source share
1 answer

You must enclose the locator in a tuple:

element = wait.until(EC.element_to_be_clickable((By.XPATH, '//span[@class="gwt-InlineLabel" and contains(text(), "Projects")]/following-sibling::*/div[@class="gwt-HTML" and contains(text(), "Add...")]')))
+4
source

Source: https://habr.com/ru/post/1598243/


All Articles