A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/seleniumhq/selenium/commit/8d5f7a4cb9481c2cfda1cbc836f9099ad99829e0 below:

[iedriver] auto detect location of Edge if not specified · SeleniumHQ/selenium@8d5f7a4 · GitHub

43 43

#define IE_SERVER_CHILD_WINDOW_CLASS "Internet Explorer_Server"

44 44

#define ANDIE_FRAME_WINDOW_CLASS "Chrome_WidgetWin_1"

45 45 46 +

#define EDGE_REGISTRY_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\msedge.exe"

46 47

#define IE_CLSID_REGISTRY_KEY L"SOFTWARE\\Classes\\InternetExplorer.Application\\CLSID"

47 48

#define IE_SECURITY_ZONES_REGISTRY_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones"

48 49

#define IE_TABPROCGROWTH_REGISTRY_KEY L"Software\\Microsoft\\Internet Explorer\\Main"

@@ -94,7 +95,8 @@ namespace webdriver {

94 95 95 96

BrowserFactory::BrowserFactory(void) {

96 97

// Must be done in the constructor. Do not move to Initialize().

97 -

this->GetExecutableLocation();

98 +

this->GetEdgeExecutableLocation();

99 +

this->GetIEExecutableLocation();

98 100

this->GetIEVersion();

99 101

this->oleacc_instance_handle_ = NULL;

100 102

this->edge_ie_mode_ = false;

@@ -240,7 +242,7 @@ bool BrowserFactory::IsIELaunchURLAvailable() {

240 242

FARPROC proc_address = 0;

241 243

proc_address = ::GetProcAddress(library_handle, IELAUNCHURL_FUNCTION_NAME);

242 244

if (proc_address == NULL || proc_address == 0) {

243 -

LOGERR(DEBUG) << "Unable to get address of " << IELAUNCHURL_FUNCTION_NAME

245 +

LOGERR(DEBUG) << "Unable to get address of " << IELAUNCHURL_FUNCTION_NAME

244 246

<< " method in " << IEFRAME_LIBRARY_NAME;

245 247

} else {

246 248

api_is_available = true;

@@ -385,7 +387,10 @@ void BrowserFactory::LaunchEdgeInIEMode(PROCESS_INFORMATION* proc_info,

385 387 386 388

std::wstring executable_and_url = this->edge_executable_location_;

387 389

if (executable_and_url == L"") {

388 -

executable_and_url = L"msedge.exe"; // Assume it's on the path if it's not passed

390 +

executable_and_url = this->edge_executable_located_location_; // Locate Edge via Registry if not passed

391 +

if (executable_and_url == L"") {

392 +

executable_and_url = L"msedge.exe"; // Assume it's on the path

393 +

}

389 394

}

390 395 391 396

// These flags force Edge into a mode where it will only run MSHTML

@@ -511,7 +516,7 @@ bool BrowserFactory::AttachToBrowser(ProcessWindowInfo* process_window_info,

511 516

zoom_level = this->GetBrowserZoomLevel(process_window_info->pBrowser);

512 517

}

513 518

if (zoom_level != 100) {

514 -

std::string zoom_level_error =

519 +

std::string zoom_level_error =

515 520

StringUtilities::Format(ZOOM_SETTING_ERROR_MESSAGE, zoom_level);

516 521

LOG(WARN) << zoom_level_error;

517 522

*error_message = zoom_level_error;

@@ -664,7 +669,7 @@ bool BrowserFactory::AttachToBrowserUsingShellWindows(

664 669

hr = shell_browser->GetWindow(&hwnd);

665 670

if (SUCCEEDED(hr)) {

666 671

::EnumChildWindows(hwnd,

667 -

&BrowserFactory::FindChildWindowForProcess,

672 +

&BrowserFactory::FindChildWindowForProcess,

668 673

reinterpret_cast<LPARAM>(process_window_info));

669 674

if (process_window_info->hwndBrowser != NULL) {

670 675

LOG(DEBUG) << "Found window handle "

@@ -876,7 +881,7 @@ IWebBrowser2* BrowserFactory::CreateBrowser(bool is_protected_mode) {

876 881

<< "be successfully created.";

877 882

}

878 883

clock_t timeout = clock() + (45 * CLOCKS_PER_SEC);

879 -

while (FAILED(hr) &&

884 +

while (FAILED(hr) &&

880 885

HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED &&

881 886

clock() < timeout) {

882 887

::Sleep(500);

@@ -925,7 +930,7 @@ bool BrowserFactory::CreateLowIntegrityLevelToken(HANDLE* process_token_handle,

925 930

}

926 931

}

927 932 928 -

if (result) {

933 +

if (result) {

929 934

result = ::ConvertStringSidToSid(SDDL_ML_LOW, sid);

930 935

if (result) {

931 936

tml.Label.Attributes = SE_GROUP_INTEGRITY;

@@ -969,13 +974,13 @@ void BrowserFactory::InvokeClearCacheUtility(bool use_low_integrity_level) {

969 974

PSID sid = NULL;

970 975 971 976

bool can_create_process = true;

972 -

if (!use_low_integrity_level ||

977 +

if (!use_low_integrity_level ||

973 978

this->CreateLowIntegrityLevelToken(&process_token, &mic_token, &sid)) {

974 979

if (0 != system_path_size &&

975 980

system_path_size <= static_cast<int>(system_path_buffer.size())) {

976 981

if (::PathCombine(&rundll_exe_path_buffer[0],

977 982

&system_path_buffer[0],

978 -

RUNDLL_EXE_NAME) &&

983 +

RUNDLL_EXE_NAME) &&

979 984

::PathCombine(&inetcpl_path_buffer[0],

980 985

&system_path_buffer[0],

981 986

INTERNET_CONTROL_PANEL_APPLET_NAME)) {

@@ -1202,14 +1207,14 @@ BOOL CALLBACK BrowserFactory::FindDialogWindowForProcess(HWND hwnd, LPARAM arg)

1202 1207

// No match found. Skip

1203 1208

return TRUE;

1204 1209

}

1205 - 1206 -

if (strcmp(ALERT_WINDOW_CLASS, name) != 0 &&

1210 + 1211 +

if (strcmp(ALERT_WINDOW_CLASS, name) != 0 &&

1207 1212

strcmp(HTML_DIALOG_WINDOW_CLASS, name) != 0 &&

1208 1213

strcmp(SECURITY_DIALOG_WINDOW_CLASS, name) != 0) {

1209 1214

return TRUE;

1210 1215

} else {

1211 -

// If the window style has the WS_DISABLED bit set or the

1212 -

// WS_VISIBLE bit unset, it can't be handled via the UI,

1216 +

// If the window style has the WS_DISABLED bit set or the

1217 +

// WS_VISIBLE bit unset, it can't be handled via the UI,

1213 1218

// and must not be a visible dialog. Furthermore, if the

1214 1219

// window style does not display a caption bar, it's not a

1215 1220

// dialog displayed by the browser, but likely by an add-on

@@ -1235,15 +1240,15 @@ BOOL CALLBACK BrowserFactory::FindDialogWindowForProcess(HWND hwnd, LPARAM arg)

1235 1240

return TRUE;

1236 1241

}

1237 1242 1238 -

void BrowserFactory::GetExecutableLocation() {

1239 -

LOG(TRACE) << "Entering BrowserFactory::GetExecutableLocation";

1243 +

void BrowserFactory::GetIEExecutableLocation() {

1244 +

LOG(TRACE) << "Entering BrowserFactory::GetIEExecutableLocation";

1240 1245 1241 1246

std::wstring class_id;

1242 1247

if (RegistryUtilities::GetRegistryValue(HKEY_LOCAL_MACHINE,

1243 1248

IE_CLSID_REGISTRY_KEY,

1244 1249

L"",

1245 1250

&class_id)) {

1246 -

std::wstring location_key = L"SOFTWARE\\Classes\\CLSID\\" +

1251 +

std::wstring location_key = L"SOFTWARE\\Classes\\CLSID\\" +

1247 1252

class_id +

1248 1253

L"\\LocalServer32";

1249 1254

std::wstring executable_location;

@@ -1284,11 +1289,40 @@ void BrowserFactory::GetExecutableLocation() {

1284 1289

}

1285 1290

}

1286 1291 1292 +

void BrowserFactory::GetEdgeExecutableLocation() {

1293 +

LOG(TRACE) << "Entering BrowserFactory::GetEdgeExecutableLocation";

1294 +

std::wstring edge_executable_location;

1295 +

if (RegistryUtilities::GetRegistryValue(HKEY_LOCAL_MACHINE,

1296 +

EDGE_REGISTRY_KEY,

1297 +

L"",

1298 +

true,

1299 +

&edge_executable_location)) {

1300 +

// If the executable location in the registry has an environment

1301 +

// variable in it, expand the environment variable to an absolute

1302 +

// path.

1303 +

DWORD expanded_location_size = ::ExpandEnvironmentStrings(edge_executable_location.c_str(), NULL, 0);

1304 +

std::vector<wchar_t> expanded_location(expanded_location_size);

1305 +

::ExpandEnvironmentStrings(edge_executable_location.c_str(), &expanded_location[0], expanded_location_size);

1306 +

edge_executable_location = &expanded_location[0];

1307 +

this->edge_executable_located_location_ = edge_executable_location;

1308 +

size_t arg_start_pos = edge_executable_location.find(L" -");

1309 +

if (arg_start_pos != std::string::npos) {

1310 +

this->edge_executable_located_location_ = edge_executable_location.substr(0, arg_start_pos);

1311 +

}

1312 +

if (this->edge_executable_located_location_.substr(0, 1) == L"\"") {

1313 +

this->edge_executable_located_location_.erase(0, 1);

1314 +

this->edge_executable_located_location_.erase(this->edge_executable_located_location_.size() - 1, 1);

1315 +

}

1316 +

} else {

1317 +

LOG(WARN) << "Unable to get Edge executable location from registry";

1318 +

}

1319 +

}

1320 + 1287 1321

void BrowserFactory::GetIEVersion() {

1288 1322

LOG(TRACE) << "Entering BrowserFactory::GetIEVersion";

1289 1323 1290 1324

std::string ie_version = FileUtilities::GetFileVersion(this->ie_executable_location_);

1291 - 1325 + 1292 1326

if (ie_version.size() == 0) {

1293 1327

// 64-bit Windows 8 has a bug where it does not return the executable location properly

1294 1328

this->ie_major_version_ = -1;

@@ -1446,7 +1480,7 @@ bool BrowserFactory::IsWindowsVersionOrGreater(unsigned short major_version,

1446 1480

VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR,

1447 1481

dwlConditionMask) != FALSE;

1448 1482

}

1449 - 1483 + 1450 1484

bool BrowserFactory::IsWindowsVistaOrGreater() {

1451 1485

return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);

1452 1486

}

@@ -1457,7 +1491,7 @@ bool BrowserFactory::IsEdgeMode() const {

1457 1491 1458 1492

// delete a folder recursively

1459 1493

int BrowserFactory::DeleteDirectory(const std::wstring &dir_name) {

1460 -

WIN32_FIND_DATA file_info;

1494 +

WIN32_FIND_DATA file_info;

1461 1495 1462 1496

std::wstring file_pattern = dir_name + L"\\*.*";

1463 1497

HANDLE file_handle = ::FindFirstFile(file_pattern.c_str(), &file_info);


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4