我想在出现时单击一个元素,但出现此错误消息:
AttributeError: 'str' object has no attribute presence_of_element_located'
这是我在Pycharm中的代码:
try:
element = WebDriverWait(self.driver, 120).until(EC.presence_of_element_located(By.XPATH, '/html/body/div[1]/section/md-content/div/div/div/div[2]/div/div/div/div/md-content/md-tabs/md-tabs-content-wrapper/md-tab-content[1]/div/section[1]/h2/button[1]'))
element.click()
finally:
self.driver.quit()
<< from selenium.webdriver.support import expected_conditions as EC
EC
变量,例如EC = "//div"
...或其他