Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

Commit

Permalink
Updating IE to return top-level URL when focused on a frame.
Browse files Browse the repository at this point in the history
This makes the driver now consistent with other implementations.
  • Loading branch information
jimevans committed Oct 8, 2015
1 parent a1da99a commit d249232
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
17 changes: 15 additions & 2 deletions cpp/iedriver/CommandHandlers/GetCurrentUrlCommandHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,21 @@ class GetCurrentUrlCommandHandler : public IECommandHandler {
return;
}

std::string url = browser_wrapper->GetCurrentUrl();
response->SetSuccessResponse(url);
CComPtr<IHTMLDocument2> top_level_document;
browser_wrapper->GetDocument(true, &top_level_document);
if (!top_level_document) {
LOG(WARN) << "Unable to get document from browser. Are you viewing a non-HTML document?";
}

CComBSTR url;
HRESULT hr = top_level_document->get_URL(&url);
if (FAILED(hr)) {
LOGHR(WARN, hr) << "IHTMLDocument2::get_URL failed.";
}

std::wstring converted_url(url, ::SysStringLen(url));
std::string current_url = StringUtilities::ToString(converted_url);
response->SetSuccessResponse(current_url);
}
};

Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/DocumentHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ std::string DocumentHost::GetCurrentUrl() {
return "";
}

std::wstring converted_url = url;
std::wstring converted_url(url, ::SysStringLen(url));
std::string current_url = StringUtilities::ToString(converted_url);
return current_url;
}
Expand Down
5 changes: 5 additions & 0 deletions cpp/iedriverserver/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ available via the project downloads page. Changes in "revision" field indicate
private releases checked into the prebuilts directory of the source tree, but
not made generally available on the downloads page.

v2.48.0.1
=========
* Updating to return top-level URL when focused on a frame. This makes the
driver now consistent with other implementations.

v2.48.0.0
=========
* Release to synchronize with release of Selenium project.
Expand Down
Binary file modified cpp/iedriverserver/IEDriverServer.rc
Binary file not shown.
Binary file modified cpp/prebuilt/Win32/Release/IEDriverServer.exe
Binary file not shown.
Binary file modified cpp/prebuilt/x64/Release/IEDriverServer.exe
Binary file not shown.

0 comments on commit d249232

Please sign in to comment.