Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions examples/python/tests/interactions/test_alerts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

global url
url = "https://www.selenium.dev/documentation/webdriver/interactions/alerts/"
Expand All @@ -13,11 +14,11 @@ def test_alert_popup():
element.click()

wait = WebDriverWait(driver, timeout=2)
alert = wait.until(lambda d : d.switch_to.alert)
alert = wait.until(EC.alert_is_present())
text = alert.text
alert.accept()
assert text == "Sample alert"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this whitespace.

driver.quit()

def test_confirm_popup():
Expand All @@ -27,7 +28,7 @@ def test_confirm_popup():
driver.execute_script("arguments[0].click();", element)

wait = WebDriverWait(driver, timeout=2)
alert = wait.until(lambda d : d.switch_to.alert)
alert = wait.until(EC.alert_is_present())
text = alert.text
alert.dismiss()
assert text == "Are you sure?"
Expand All @@ -41,7 +42,7 @@ def test_prompt_popup():
driver.execute_script("arguments[0].click();", element)

wait = WebDriverWait(driver, timeout=2)
alert = wait.until(lambda d : d.switch_to.alert)
alert = wait.until(EC.alert_is_present())
alert.send_keys("Selenium")
text = alert.text
alert.accept()
Expand Down
Loading