Talib
Talib

Reputation: 83

Handle PopUp in selenium python

I am new to selenium. I am having a pop up. i have attached the picture. How can I handle it. I have tried switch_to_alert()

but it did not worked.

enter image description here

Upvotes: 2

Views: 2037

Answers (1)

Andersson
Andersson

Reputation: 52665

It's not an alert, so it should be handled as common element:

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()

to confirm

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[text()="Cancel"]'))).click()

to decline

Upvotes: 2

Related Questions