答案 0 :(得分:2)
这不是警报,因此应将其视为常见元素:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[text()="Process Payments"]'))).click()
确认
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[text()="Cancel"]'))).click()
拒绝