作者z6877352 (伦仔)
看板Python
标题[问题] selenium爬虫checkbox一直勾选不到
时间Sun Apr 9 16:02:39 2023
最近要爬虫一个表单然後自动勾选
但最後一项有一个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://webptt.com/cn.aspx?n=bbs/Python/M.1681027361.A.389.html
1F:→ keepingJBJ: 丢上chatGPT ,请response python script 04/11 05:16
2F:→ z6877352: 谢谢 AI科技太强了 已解决 04/11 16:49
3F:推 Mahakala: 这样也行?(惊) 04/20 12:34
4F:推 s860134: 因为你是第101 问这个问题的人. 04/23 20:03
5F:推 gostjoke: 可以推荐你直接用katalon录然後导出python 那更快 05/11 18:22