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

Method LaunchBrowserUsingCreateProcess

cpp/iedriver/BrowserFactory.cpp:302–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void BrowserFactory::LaunchBrowserUsingCreateProcess(PROCESS_INFORMATION* proc_info,
303 std::string* error_message) {
304 LOG(TRACE) << "Entering BrowserFactory::LaunchBrowserUsingCreateProcess";
305 LOG(DEBUG) << "Starting IE using the CreateProcess API";
306
307 STARTUPINFO start_info;
308 ::ZeroMemory(&start_info, sizeof(start_info));
309 start_info.cb = sizeof(start_info);
310
311 std::wstring executable_and_url = this->ie_executable_location_;
312 if (this->browser_command_line_switches_.size() != 0) {
313 executable_and_url.append(L" ");
314 executable_and_url.append(this->browser_command_line_switches_);
315 }
316 executable_and_url.append(L" ");
317 executable_and_url.append(this->initial_browser_url_);
318
319 LOG(TRACE) << "IE starting command line is: '"
320 << LOGWSTRING(executable_and_url) << "'.";
321
322 LPWSTR command_line = new WCHAR[executable_and_url.size() + 1];
323 wcscpy_s(command_line,
324 executable_and_url.size() + 1,
325 executable_and_url.c_str());
326 command_line[executable_and_url.size()] = L'\0';
327 BOOL create_process_result = ::CreateProcess(NULL,
328 command_line,
329 NULL,
330 NULL,
331 FALSE,
332 0,
333 NULL,
334 NULL,
335 &start_info,
336 proc_info);
337 if (!create_process_result) {
338 *error_message = StringUtilities::Format(CREATEPROCESS_ERROR_MESSAGE,
339 StringUtilities::ToString(command_line));
340 }
341 delete[] command_line;
342}
343
344bool BrowserFactory::DirectoryExists(std::wstring& dir_name) {
345 DWORD attribs = ::GetFileAttributes(dir_name.c_str());

Callers 1

LaunchBrowserProcessMethod · 0.95

Calls 3

LOGClass · 0.50
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected