Usually, alerts in selenium are handled by switching to alert using driver.swichto().alert();
Alert can be of prompt , confirm or simple type.
I need help in finding the type of alert occurred to trigger the appropriate operation
Thanks In advance..!!
There are certain types of Alerts.
First one is the normal Alert where we use accept() & dismiss() to handle it. Elements of this type of Alerts are not part of the HTML DOM. For this type of Alerts you need handle as below:
//Switch to the Alert & Dismiss
driver.switchTo().alert().dismiss();
or
//Switch to Alert & Accept
driver.switchTo().alert().accept();
Let me know if this answers your question.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.