看板 Python 關於我們 聯絡資訊
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://www.ptt.cc/bbs/Python/M.1574932810.A.DE8.html ※ 編輯: alvinlin (123.192.184.90 臺灣), 11/28/2019 17:24:43