Reputation: 4072
I am using Python Webdriver. I am having trouble clicking on an Add button. I am using Webdriver Wait, I am getting the following error when i run 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 is
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? The Xpath is valid as i have checked it in Firefox, Firepath. It finds the button.
Upvotes: 4
Views: 2167
Reputation: 474041
You have to 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...")]')))
Upvotes: 4