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

Method OnWait

cpp/iedriver/IECommandExecutor.cpp:214–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214LRESULT IECommandExecutor::OnWait(UINT uMsg,
215 WPARAM wParam,
216 LPARAM lParam,
217 BOOL& bHandled) {
218 LOG(TRACE) << "Entering IECommandExecutor::OnWait";
219
220 LPCSTR str = reinterpret_cast<LPCSTR>(lParam);
221 std::string deferred_response(str);
222 delete[] str;
223
224 LOG(DEBUG) << "Starting wait cycle.";
225 if (this->is_awaiting_new_window_) {
226 LOG(DEBUG) << "Awaiting new window. Aborting current wait cycle and "
227 << "scheduling another.";
228 this->CreateWaitThread(deferred_response);
229 return 0;
230 }
231
232 bool is_single_wait = (wParam == 0);
233
234 BrowserHandle browser;
235 int status_code = this->GetCurrentBrowser(&browser);
236 if (status_code == WD_SUCCESS) {
237 if (!browser->is_closing()) {
238 if (this->page_load_timeout_ >= 0 && this->wait_timeout_ < clock()) {
239 LOG(DEBUG) << "Page load timeout reached. Ending wait cycle.";
240 Response timeout_response;
241 timeout_response.SetErrorResponse(ERROR_WEBDRIVER_TIMEOUT,
242 "Timed out waiting for page to load.");
243 browser->set_wait_required(false);
244 this->serialized_response_ = timeout_response.Serialize();
245 this->is_waiting_ = false;
246 return 0;
247 } else {
248 LOG(DEBUG) << "Beginning wait.";
249 this->is_waiting_ = !(browser->Wait(this->page_load_strategy_));
250 if (is_single_wait) {
251 LOG(DEBUG) << "Single requested wait with no deferred "
252 << "response complete. Ending wait cycle.";
253 this->is_waiting_ = false;
254 return 0;
255 } else {
256 if (this->is_waiting_) {
257 LOG(DEBUG) << "Wait not complete. Scheduling another wait cycle.";
258 this->CreateWaitThread(deferred_response);
259 return 0;
260 }
261 }
262 }
263 }
264 }
265 LOG(DEBUG) << "Wait complete. Setting serialized response to deferred value "
266 << deferred_response;
267 this->serialized_response_ = deferred_response;
268 this->is_waiting_ = false;
269 return 0;
270}
271

Callers

nothing calls this directly

Calls 8

CreateWaitThreadMethod · 0.95
GetCurrentBrowserMethod · 0.95
is_closingMethod · 0.80
SetErrorResponseMethod · 0.80
set_wait_requiredMethod · 0.80
LOGClass · 0.50
SerializeMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected