python3 selenium 超時停止加載,並且捕捉異常, 進行下一步【親測有效】

# 兩個同時設置才行
# 實現效果:加載狀態停止,進行代碼下一步操作
driver.set_page_load_timeout(10)
driver.set_script_timeout(10)  # 這兩種設置都進行纔有效
try:
    driver.get("https://shopee.co.id/search?keyword=jam%20tangan&page=" + str(page) + "&sortBy=" + rankBY)
except:
    driver.execute_script('window.stop()')

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章