标签:col rom web自动化 driver import 自动 selenium bsp class
from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("url") # 判断alert是否出现 WebDriverWait(driver,20).until(EC.alert_is_present()) # 进入alert弹窗 alert = driver.switch_to.alert # 获取alert弹窗的文本 alert.text # 输入文本 alert.send_keys("随便") # 接受弹窗 alert.accept() # 取消弹窗 alert.dismiss()
标签:col rom web自动化 driver import 自动 selenium bsp class
原文地址:https://www.cnblogs.com/666666pingzi/p/10568864.html