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

Method Accept

cpp/iedriver/Alert.cpp:74–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74int Alert::Accept() {
75 LOG(TRACE) << "Entering Alert::Accept";
76 DialogButtonInfo button_info = this->GetDialogButton(OK);
77 if (!button_info.button_exists) {
78 // No OK button on dialog. Look for a cancel button
79 // (JavaScript alert() dialogs have a single button, but its ID
80 // can be that of a "cancel" button.)
81 LOG(INFO) << "OK button does not exist on dialog; looking for Cancel button";
82 button_info = this->GetDialogButton(CANCEL);
83 }
84
85 if (!button_info.button_exists) {
86 LOG(WARN) << "OK and Cancel button do not exist on alert";
87 return EUNHANDLEDERROR;
88 }
89
90 LOG(DEBUG) << "Closing alert using SendMessage";
91 int status_code = this->ClickAlertButton(button_info);
92 return WD_SUCCESS;
93}
94
95int Alert::Dismiss() {
96 LOG(TRACE) << "Entering Alert::Dismiss";

Callers 4

OnBrowserCloseWaitMethod · 0.45
OnSessionQuitWaitMethod · 0.45
HandleUnexpectedAlertMethod · 0.45
ExecuteInternalMethod · 0.45

Calls 3

GetDialogButtonMethod · 0.95
ClickAlertButtonMethod · 0.95
LOGClass · 0.50

Tested by

no test coverage detected