Selenium automated confirm bullet box solution

The bullet boxes mainly include the following:

  1. alert box

  1. The confirm bullet box and the alert bullet box add a cancel button

  1. The prompt bullet box and the alert bullet box have added confirmation content

Today we mainly solve the confirm bullet box, bullet box

method one

options=webdriver.IeOptions()

options.ignore_protected_mode_settings=True

options.binary_location=r'D:\Program Files\360\360se6\Application\360se.exe'

driver=webdriver.Ie(executable_path="D:\Python\Python36\IEDriverServer.exe",options=options)

driver.get("http://10.0.0.1:9080/")

confirmAlert=driver.switch_to_alert();

confirmAlert.accept()#Click OK

confirmAlert.dismiss()#Click to cancel

Method Two:

from selenium.webdriver.common.alert import Alert

options=webdriver.IeOptions()

options.ignore_protected_mode_settings=True

options.binary_location=r'D:\Program Files\360\360se6\Application\360se.exe'

driver=webdriver.Ie(executable_path="D:\Python\Python36\IEDriverServer.exe",options=options)

driver.get("http://10.0.0.1:9080/")

confirmAlert=Alert(driver)

confirmAlert.dismiss()#Click OK

#confirmAlert.accept()#Click to cancel

Guess you like

Origin blog.csdn.net/u012388338/article/details/129681157