Selenium ElementNotInteractableException:提交按钮不起作用
Selenium ElementNotInteractableException: submit button wont work
我从昨天开始就一直在从网站上抓取信息,但是提交按钮不能点击。
这是代码
button = driver.find_element_by_id('ctl00_PlaceHolderMain_g_6c89d4ad_107f_437d_bd54_8fda17b556bf_ctl00_btnSearch2').click()
这是来自网站的元素
<input type="submit" name="ctl00$PlaceHolderMain$g_6c89d4ad_107f_437d_bd54_8fda17b556bf$ctl00$btnSearch2" value="Cari" onclick="SetSource(this.id);" id="ctl00_PlaceHolderMain_g_6c89d4ad_107f_437d_bd54_8fda17b556bf_ctl00_btnSearch2" class="btn btn-primary" autopostback="True" style="margin-top: 31px">
错误
ElementNotInteractableException: Message: element not interactable
(Session info: chrome=87.0.4280.141
网站link:https://www.bi.go.id/id/statistik/informasi-kurs/transaksi-bi/Default.aspx卡里按钮
我希望你能理解我的问题!提前谢谢你
WebDriverWait(driver, 15).until(EC.element_to_be_clickable(
By.xpath, "//input[@id='ctl00_PlaceHolderMain_g_6c89d4ad_107f_437d_bd54_8fda17b556bf_ctl00_btnSearch2']"))
你能试试显式等待吗
试试这个。
time.sleep(5)
buttons = driver.find_elements_by_xpath("//input[@value='Cari']")
这个returns2个按钮。选择你想要的那个。
buttons[0].click()
#First button..Currency selector?
buttons[1].click()
#第二个按钮..日期选择器.
检查元素。打开开发者控制台。按 CTRL+F。在栏中键入 xpath
。它将突出显示元素并显示具有相同属性的元素有多少。
我从昨天开始就一直在从网站上抓取信息,但是提交按钮不能点击。
这是代码
button = driver.find_element_by_id('ctl00_PlaceHolderMain_g_6c89d4ad_107f_437d_bd54_8fda17b556bf_ctl00_btnSearch2').click()
这是来自网站的元素
<input type="submit" name="ctl00$PlaceHolderMain$g_6c89d4ad_107f_437d_bd54_8fda17b556bf$ctl00$btnSearch2" value="Cari" onclick="SetSource(this.id);" id="ctl00_PlaceHolderMain_g_6c89d4ad_107f_437d_bd54_8fda17b556bf_ctl00_btnSearch2" class="btn btn-primary" autopostback="True" style="margin-top: 31px">
错误
ElementNotInteractableException: Message: element not interactable
(Session info: chrome=87.0.4280.141
网站link:https://www.bi.go.id/id/statistik/informasi-kurs/transaksi-bi/Default.aspx卡里按钮 我希望你能理解我的问题!提前谢谢你
WebDriverWait(driver, 15).until(EC.element_to_be_clickable(
By.xpath, "//input[@id='ctl00_PlaceHolderMain_g_6c89d4ad_107f_437d_bd54_8fda17b556bf_ctl00_btnSearch2']"))
你能试试显式等待吗
试试这个。
time.sleep(5)
buttons = driver.find_elements_by_xpath("//input[@value='Cari']")
这个returns2个按钮。选择你想要的那个。
buttons[0].click()
#First button..Currency selector?
buttons[1].click()
#第二个按钮..日期选择器.
检查元素。打开开发者控制台。按 CTRL+F。在栏中键入 xpath
。它将突出显示元素并显示具有相同属性的元素有多少。