ykyk
ykyk

Reputation: 69

Python Selenuim Alert Box Disable?

How can I tell selenium to press cancel in this case or remove the whole box completely. I looked around and only really saw C# answers. Thank you for your time :)

enter image description here

Upvotes: 0

Views: 442

Answers (1)

cruisepandey
cruisepandey

Reputation: 29362

At first glance, it seems like that's an Alert.

In Python-Selenium you could do this:

Alert = driver.switch_to.alert
Alert.dismiss()

However, It could be a pop-up in HTMLDOM as well. In this case, you will have to find the right locator (CSS, XPath etc.) and perform a click on that cancel button.

Upvotes: 1

Related Questions