Skip to content

Commit

Permalink
[ChromeDriver] Make ExecuteSwitchToFrame() W3C compliant
Browse files Browse the repository at this point in the history
Bug: chromedriver:1992
Change-Id: If7729d68d753459a9b27fc52d053d5f065341c24
Reviewed-on: https://chromium-review.googlesource.com/1229188
Reviewed-by: John Chen <johnchen@chromium.org>
Commit-Queue: Tatiana Buldina <buldina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591868}
  • Loading branch information
Tatiana Buldina authored and Commit Bot committed Sep 17, 2018
1 parent 9277dfc commit 7083138
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions chrome/test/chromedriver/element_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ namespace {
const char kElementKey[] = "ELEMENT";
const char kElementKeyW3C[] = "element-6066-11e4-a52e-4f735466cecf";

std::string GetElementKey() {
Session* session = GetThreadLocalSession();
if (session && session->w3c_compliant)
return kElementKeyW3C;
else
return kElementKey;
}

bool ParseFromValue(base::Value* value, WebPoint* point) {
base::DictionaryValue* dict_value;
if (!value->GetAsDictionary(&dict_value))
Expand Down Expand Up @@ -249,6 +241,14 @@ Status GetElementBorder(

} // namespace

std::string GetElementKey() {
Session* session = GetThreadLocalSession();
if (session && session->w3c_compliant)
return kElementKeyW3C;
else
return kElementKey;
}

std::unique_ptr<base::DictionaryValue> CreateElement(
const std::string& element_id) {
std::unique_ptr<base::DictionaryValue> element(new base::DictionaryValue());
Expand Down
2 changes: 2 additions & 0 deletions chrome/test/chromedriver/element_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct Session;
class Status;
class WebView;

std::string GetElementKey();

std::unique_ptr<base::DictionaryValue> CreateElement(
const std::string& element_id);

Expand Down
2 changes: 1 addition & 1 deletion chrome/test/chromedriver/window_commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ Status ExecuteSwitchToFrame(Session* session,
const base::DictionaryValue* id_dict;
if (id->GetAsDictionary(&id_dict)) {
std::string element_id;
if (!id_dict->GetString("ELEMENT", &element_id))
if (!id_dict->GetString(GetElementKey(), &element_id))
return Status(kUnknownError, "missing 'ELEMENT'");
bool is_displayed = false;
Status status = IsElementDisplayed(
Expand Down
2 changes: 1 addition & 1 deletion docs/chromedriver_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Below is a list of all WebDriver commands and their current support in ChromeDri
| DELETE | /session/{session id}/window | Close Window | Complete |
| POST | /session/{session id}/window | Switch To Window | Complete |
| GET | /session/{session id}/window/handles | Get Window Handles | Complete |
| POST | /session/{session id}/frame | Switch To Frame | Partially Complete | [1992](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1992)
| POST | /session/{session id}/frame | Switch To Frame | Complete |
| POST | /session/{session id}/frame/parent | Switch To Parent Frame | |
| GET | /session/{session id}/window/rect | Get Window Rect | Complete |
| POST | /session/{session id}/window/rect | Set Window Rect | Complete |
Expand Down

0 comments on commit 7083138

Please sign in to comment.