I'm receiving the following error:
Traceback (most recent call last): File "[redacted]", line 69, in wait.until(EC.element_to_be_clickable(By.ID("RptViewer_ctl09_ctl04_ctl00_ButtonLink"))) TypeError: 'str' object is not callable
Here's the section of code I believe is causing the problem:
66 browser.find_element_by_id('RptViewer_ctl09_ctl04_ctl00_ButtonLink')
67 drp = browser.find_element_by_id('RptViewer_ctl09_ctl04_ctl00_ButtonLink')
68 wait = WebDriverWait(browser, 10)
69 wait.until(EC.element_to_be_clickable(By.ID('RptViewer_ctl09_ctl04_ctl00_ButtonLink')))
70 drp.click()
I think what's causing the issue is the "ID('RptViewer_ctl09_ctl04_ctl00_ButtonLink')" section but I'm not sure if that's true and I'm not sure of how to fix it. Any guidance is extremely appreciated.
Thanks!
By.ID is a string. Not callable. Expected condition takes locator in a form of a tuple (as quamrana already suggested)
将WebDriverWait与expected_conditions 结合使用时,您必须将定位器包含在一个元组中,如下所示:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "RptViewer_ctl09_ctl04_ctl00_ButtonLink")))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.