Re: [问题] requests alert

楼主: alvinlin (林矜业)   2019-11-28 17:20:08
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来爬。
: 谢谢大家

Links booklink

Contact Us: admin [ a t ] ucptt.com