Skip to content

Commit ffb5026

Browse files
committed
[iedriver] use Edge if iexplorer is set to redirect to Edge
1 parent 8d5f7a4 commit ffb5026

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

cpp/iedriver/BrowserFactory.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
#define EDGE_REGISTRY_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\msedge.exe"
4747
#define IE_CLSID_REGISTRY_KEY L"SOFTWARE\\Classes\\InternetExplorer.Application\\CLSID"
48+
#define IE_REDIRECT L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Ext\\CLSID"
4849
#define IE_SECURITY_ZONES_REGISTRY_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones"
4950
#define IE_TABPROCGROWTH_REGISTRY_KEY L"Software\\Microsoft\\Internet Explorer\\Main"
5051

@@ -126,7 +127,7 @@ void BrowserFactory::Initialize(BrowserFactorySettings settings) {
126127
this->clear_cache_ = settings.clear_cache_before_launch;
127128
this->browser_command_line_switches_ = StringUtilities::ToWString(settings.browser_command_line_switches);
128129
this->initial_browser_url_ = StringUtilities::ToWString(settings.initial_browser_url);
129-
this->edge_ie_mode_ = settings.attach_to_edge_ie;
130+
this->edge_ie_mode_ = settings.attach_to_edge_ie || this->ie_redirects_edge_;
130131
LOG(DEBUG) << "path before was " << settings.edge_executable_path << "\n";
131132
this->edge_executable_location_ = StringUtilities::ToWString(settings.edge_executable_path);
132133
LOG(DEBUG) << "path after was " << this->edge_executable_location_.c_str() << "\n";
@@ -1243,6 +1244,17 @@ BOOL CALLBACK BrowserFactory::FindDialogWindowForProcess(HWND hwnd, LPARAM arg)
12431244
void BrowserFactory::GetIEExecutableLocation() {
12441245
LOG(TRACE) << "Entering BrowserFactory::GetIEExecutableLocation";
12451246

1247+
std::wstring redirection;
1248+
if (RegistryUtilities::GetRegistryValue(HKEY_LOCAL_MACHINE,
1249+
IE_REDIRECT,
1250+
L"{1FD49718-1D00-4B19-AF5F-070AF6D5D54C}",
1251+
&redirection)) {
1252+
this->ie_redirects_edge_ = redirection == L"1";
1253+
}
1254+
else {
1255+
LOG(WARN) << "Unable to determine IE to Edge Redirection";
1256+
}
1257+
12461258
std::wstring class_id;
12471259
if (RegistryUtilities::GetRegistryValue(HKEY_LOCAL_MACHINE,
12481260
IE_CLSID_REGISTRY_KEY,

cpp/iedriver/BrowserFactory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class BrowserFactory {
133133
int ie_major_version_;
134134
std::wstring ie_executable_location_;
135135
std::wstring edge_executable_located_location_;
136+
bool ie_redirects_edge_;
136137

137138
bool edge_ie_mode_;
138139
std::wstring edge_executable_location_;

0 commit comments

Comments
 (0)