[問題] selenium爬蟲checkbox一直勾選不到
最近要爬蟲一個表單然後自動勾選
但最後一項有一個checkbox一直出現錯誤
求版上大師解惑
網址如下
https://cyp.gopomo.com/locations/street-artist/cultural-park/book/#viewStreetPe
最後下面的使用切結書勾選一直勾不到
F12爬蟲檢查是checkbox屬性如下
<input class="custom-control-input form-check-input" type="checkbox"
id="affidavitConfirm" required="">
我的pythom如下-----------------------------------------
from selenium import webdriver
from selenium.webdriver.chrome.webdriver import WebDriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as
contact_name = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.NAME, "contact_name"))
)
---------------出現Name後開始執行作業-----------------
agree = driver.find_element(By.ID,("affidavitConfirm"))
agree.click()
---------------尋找ID為affidavitConfirm並點擊---------
嘗試一直跳出
selenium.common.exceptions.ElementClickInterceptedException: Message: element
click intercepted: Element <input class="custom-control-input
form-check-input" type="checkbox" id="affidavitConfirm" required=""> is not
clickable at point (313, 882). Other element would receive the click: <label
class="custom-control-label form-check-label"
for="affidavitConfirm">...</label>
(Session info: chrome=112.0.5615.50)
網路爬文改了很多種方式 都沒有實際解決問題 不曉得怎麼打才是正確的
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.232.82.1 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1681027361.A.389.html
→
04/11 05:16,
1年前
, 1F
04/11 05:16, 1F
→
04/11 16:49,
1年前
, 2F
04/11 16:49, 2F