Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2230)

Unified Diff: chrome/test/chromedriver/element_util.cc

Issue 2230053002: [chromedriver] Added option to make element references W3C compliant. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed presubmit errors. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/chromedriver/commands.cc ('k') | chrome/test/chromedriver/js/call_function.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..98570dee6c3eb448afb64980ff4c64d43acb0605 100644
--- a/chrome/test/chromedriver/element_util.cc
+++ b/chrome/test/chromedriver/element_util.cc
@@ -23,6 +23,16 @@
namespace {
const char kElementKey[] = "ELEMENT";
+const char kElementKeyW3C[] = "element-6066-11e4-a52e-4f735466cecf";
+
+std::string GetElementKey() {
+ Session* session = GetThreadLocalSession();
+ CHECK(session);
+ if (session->w3c_compliant)
+ return kElementKeyW3C;
+ else
+ return kElementKey;
+}
bool ParseFromValue(base::Value* value, WebPoint* point) {
base::DictionaryValue* dict_value;
@@ -209,7 +219,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 +272,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 +391,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 +639,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.
« no previous file with comments | « chrome/test/chromedriver/commands.cc ('k') | chrome/test/chromedriver/js/call_function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698