Alert is a popup window which shows on screen when we click any button or open a new window.
There are different reasons when an alert shows on the screen.
When the user clicks on a button it shows an alert popup with a message , it asks us to enter some text in it etc.
accept() Method:
This method is used to click on “OK button”.
Syntax: alert_class_object.accept()
dismiss() Method:
This method is used to click on the “Cancel button”.
Syntax: alert_class_object.dismiss()
text property :
This property is used to fetch the text on a given WebElement.It doesn’t take any argument and it returns a string value.
Syntax: alert_class_object.text
send_keys() :
This method enters a text in an editbox.It takes a string as an argument and it doesn’t return anything.
Syntax: alert_class_object.send_keys(“text value”)
Let's discuss one by one in the next chapter.