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

Method LaunchEdgeInIEMode

cpp/iedriver/BrowserFactory.cpp:383–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void BrowserFactory::LaunchEdgeInIEMode(PROCESS_INFORMATION* proc_info,
384 std::string* error_message) {
385 LOG(TRACE) << "Entering BrowserFactory::LaunchEdgeInIEMode";
386 LOG(DEBUG) << "Starting Edge Chromium from the command line";
387
388 STARTUPINFO start_info;
389 ::ZeroMemory(&start_info, sizeof(start_info));
390 start_info.cb = sizeof(start_info);
391
392 std::wstring executable_and_url = this->edge_executable_location_;
393 if (executable_and_url == L"") {
394 executable_and_url = this->edge_executable_located_location_; // Locate Edge via Registry if not passed
395 if (executable_and_url == L"") {
396 executable_and_url = L"msedge.exe"; // Assume it's on the path
397 }
398 }
399
400 // These flags force Edge into a mode where it will only run MSHTML
401 executable_and_url.append(L" --ie-mode-force");
402 executable_and_url.append(L" --internet-explorer-integration=iemode");
403
404 // create a temporary directory for IEDriver test
405 std::wstring temp_dir;
406 if (CreateUniqueTempDir(temp_dir)) {
407 LOG(TRACE) << L"Using temporary folder " << LOGWSTRING(temp_dir) << ".";
408 executable_and_url.append(L" --user-data-dir=" + temp_dir);
409 this->edge_user_data_dir_ = temp_dir;
410 }
411
412 // Prevent Edge from showing first run experience tab.
413 executable_and_url.append(L" --no-first-run");
414
415 // Disable Edge prelaunch and other background processes on startup.
416 executable_and_url.append(L" --no-service-autorun");
417
418 // Disable profile sync and implicit MS account sign-in.
419 executable_and_url.append(L" --disable-sync");
420 executable_and_url.append(L" --disable-features=msImplicitSignin");
421
422 // ALways allow popups for testing.
423 executable_and_url.append(L" --disable-popup-blocking");
424
425 // Ensure IE Mode tabs have a chance to shut down cleanly before the Edge process exits.
426 executable_and_url.append(L" --enable-features=msIEModeAlwaysWaitForUnload");
427
428 executable_and_url.append(L" ");
429 executable_and_url.append(this->initial_browser_url_);
430
431 LOG(TRACE) << "Edge in IE Mode starting command line is: '"
432 << LOGWSTRING(executable_and_url) << "'.";
433
434 LPWSTR command_line = new WCHAR[executable_and_url.size() + 1];
435 wcscpy_s(command_line,
436 executable_and_url.size() + 1,
437 executable_and_url.c_str());
438 command_line[executable_and_url.size()] = L'\0';
439 BOOL create_process_result = ::CreateProcess(NULL,
440 command_line,

Callers 1

LaunchBrowserProcessMethod · 0.95

Calls 3

LOGClass · 0.50
appendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected