MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / Dismiss

Method Dismiss

cpp/iedriver/Alert.cpp:95–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int Alert::Dismiss() {
96 LOG(TRACE) << "Entering Alert::Dismiss";
97 DialogButtonInfo button_info = this->GetDialogButton(CANCEL);
98 if (!button_info.button_exists) {
99 if (!this->is_standard_control_alert_) {
100 // If this is not a standard control alert (i.e., has the
101 // "do not create any more dialogs check box"), the use of
102 // dialog control IDs won't work, so we have to look explicitly
103 // for the OK button.
104 button_info = this->GetDialogButton(OK);
105 }
106 }
107
108 if (!button_info.button_exists) {
109 LOG(WARN) << "Cancel button does not exist on alert";
110 return EUNHANDLEDERROR;
111 }
112
113 // TODO(JimEvans): Check return code and return an appropriate
114 // error if the alert didn't get closed properly.
115 LOG(DEBUG) << "Closing alert using SendMessage";
116 int status_code = this->ClickAlertButton(button_info);
117 return WD_SUCCESS;
118}
119
120int Alert::SendKeys(const std::string& keys) {
121 LOG(TRACE) << "Entering Alert::SendKeys";

Callers 2

HandleUnexpectedAlertMethod · 0.45
ExecuteInternalMethod · 0.45

Calls 3

GetDialogButtonMethod · 0.95
ClickAlertButtonMethod · 0.95
LOGClass · 0.50

Tested by

no test coverage detected