R
R
Rudy99662022-01-03 22:54:33
Python
Rudy9966, 2022-01-03 22:54:33

How to perform a browser action in Selenium?

How to prescribe that he would click "Close"?
image.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2022-01-03
@ScriptKiddo

Popup documentation
https://www.selenium.dev/documentation/webdriver/b...

# Click the link to activate the alert
driver.find_element(By.LINK_TEXT, "See a sample confirm").click()

# Wait for the alert to be displayed
wait.until(expected_conditions.alert_is_present())

# Store the alert in a variable for reuse
alert = driver.switch_to.alert

# Store the alert text in a variable
text = alert.text

# Press the Cancel button
alert.dismiss()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question