【发布时间】:2023-04-04 19:14:01
【问题描述】:
我正在使用 Python Webdriver。我在单击“添加”按钮时遇到问题。 我正在使用 Webdriver 等等,运行代码时出现以下错误。
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)
我的 webdriver 代码是
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()
我做错了什么? Xpath 是有效的,因为我在 Firefox,Firepath 中检查过它。它找到了按钮。
【问题讨论】:
标签: python selenium xpath selenium-webdriver