Why switching to alert through selenium is not stable?

前端 未结 2 1725
不思量自难忘°
不思量自难忘° 2020-12-04 01:28

Why switching to alert through selenium is not stable?

For example.
1. Run a code and all good. Everything worked out well. But if this code is run in a few min

2条回答
  •  遥遥无期
    2020-12-04 01:49

    This will click the OK button on the alert:

    driver.switch_to.alert.accept() 
    

    This will click the CANCEL button on the alert:

    driver.switch_to.alert.dismiss()     
    

提交回复
热议问题