作者alvinlin (康斯坦汀《驱魔神探》)
看板Python
标题Re: [问题] requests alert
时间Thu Nov 28 17:20:08 2019
from selenium.webdriver.support import expected_conditions as EC
try:
# 确定有弹出错误讯息 ?
WebDriverWait(agentChrome, 3).until(EC.alert_is_present(), 'Time Waited')
alertNoDataFound = agentChrome.switch_to.alert
except:
# 没有弹出错误讯息.
print('Great!')
※ 引述《bnn1999 (bnn1999)》之铭言:
: 大家好,用requests爬网站时,有些网站会跳alert视窗出来,但我要的资讯在alert点击
: 确认後才会出现。
: 我想请问要什麽办法能够侦测alert视窗,或是侦测到什麽东西改用selenium来爬。
: 谢谢大家
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 123.192.184.90 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1574932810.A.DE8.html
※ 编辑: alvinlin (123.192.184.90 台湾), 11/28/2019 17:24:43