| Index: chrome/test/chromedriver/element_util.cc
|
| diff --git a/chrome/test/chromedriver/element_util.cc b/chrome/test/chromedriver/element_util.cc
|
| index 7ba14d30791ff33dcf8afa465c08ef2cee4a0f10..e8f6610eebd82824245a30937a7dec57ec4cc6c0 100644
|
| --- a/chrome/test/chromedriver/element_util.cc
|
| +++ b/chrome/test/chromedriver/element_util.cc
|
| @@ -23,6 +23,15 @@
|
| 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;
|
| @@ -209,7 +218,7 @@ Status GetElementBorder(
|
|
|
| base::DictionaryValue* CreateElement(const std::string& element_id) {
|
| base::DictionaryValue* element = new base::DictionaryValue();
|
| - element->SetString(kElementKey, element_id);
|
| + element->SetString(GetElementKey(), element_id);
|
| return element;
|
| }
|
|
|
| @@ -262,7 +271,6 @@ Status FindElement(int interval_ms,
|
| base::ListValue* result;
|
| if (!temp->GetAsList(&result))
|
| return Status(kUnknownError, "script returns unexpected result");
|
| -
|
| if (result->GetSize() > 0U) {
|
| value->reset(temp.release());
|
| return Status(kOk);
|
| @@ -382,7 +390,7 @@ Status GetElementClickableLocation(
|
| return status;
|
| const base::DictionaryValue* element_dict;
|
| if (!result->GetAsDictionary(&element_dict) ||
|
| - !element_dict->GetString(kElementKey, &target_element_id))
|
| + !element_dict->GetString(GetElementKey(), &target_element_id))
|
| return Status(kUnknownError, "no element reference returned by script");
|
| }
|
| bool is_displayed = false;
|
| @@ -630,7 +638,7 @@ Status ScrollElementRegionIntoView(
|
| if (!result->GetAsDictionary(&element_dict))
|
| return Status(kUnknownError, "no element reference returned by script");
|
| std::string frame_element_id;
|
| - if (!element_dict->GetString(kElementKey, &frame_element_id))
|
| + if (!element_dict->GetString(GetElementKey(), &frame_element_id))
|
| return Status(kUnknownError, "failed to locate a sub frame");
|
|
|
| // Modify |region_offset| by the frame's border.
|
|
|