import time from selenium import webdriver driver =webdriver.Chrome(r"D:\工具包\chromedriver.exe") driver.maximize_window() driver.implicitly_wait(6) driver.get("https://www.baidu.com") time.sleep(1) driver.execute_script("window.alert(‘这是一个测试Alert弹窗‘);") time.sleep(2) driver.switch_to_alert().accept() # 点击弹出里面的确定按钮
原文地址:https://www.cnblogs.com/2sheep2simple/p/10301626.html
时间: 2024-10-09 17:29:26