The Alert implementation.
-
-
class Selenium.webdriver.common.alert. Alert (
driver )
-
Bases: Object
Allows to work with alerts.
Use the This class to interact with alert prompts. It contains methods for dismissing, accepting, inputting, and getting text from alert prompts.
Accepting/dismissing Alert prompts:
Alert(driver). Accept()Alert(driver). Dismiss()
Inputting a value into an alert prompt:
name_prompt = Alert (Driver) name_prompt.send_keys ("Willian Shakesphere") name_prompt.accept ()
Reading a The text of a prompt for verification:
alert_text = alert (driver). Text Self.assertequal ("Do you wish to quit?", Alert_text)
- Accept ( )
-
Accepts the alert available.
Usage:: Alert (Driver). Accept () # Confirm a alert dialog.
- Dismiss ( )
-
Dismisses the alert available.
- Send_keys (
keystosend )
-
Send Keys to the Alert.
Args: |
- Keystosend:the text to is sent to Alert.
|
- Text
-
Gets the text of the Alert.
Webdriver api--Part 4th alerts