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

Side by Side Diff: chrome/test/chromedriver/window_commands.cc

Issue 1799183002: [ChromeDriver] Add nested frame xpath expression in order to switch to frame present inside nested … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/chromedriver/window_commands.h" 5 #include "chrome/test/chromedriver/window_commands.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 const base::DictionaryValue* id_dict; 340 const base::DictionaryValue* id_dict;
341 if (id->GetAsDictionary(&id_dict)) { 341 if (id->GetAsDictionary(&id_dict)) {
342 script = "function(elem) { return elem; }"; 342 script = "function(elem) { return elem; }";
343 args.Append(id_dict->DeepCopy()); 343 args.Append(id_dict->DeepCopy());
344 } else { 344 } else {
345 script = 345 script =
346 "function(xpath) {" 346 "function(xpath) {"
347 " return document.evaluate(xpath, document, null, " 347 " return document.evaluate(xpath, document, null, "
348 " XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" 348 " XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;"
349 "}"; 349 "}";
350 std::string xpath = "(/html/body//iframe|/html/frameset/frame)"; 350 std::string xpath = "(/html/body//iframe|/html/frameset//frame)";
351 std::string id_string; 351 std::string id_string;
352 int id_int; 352 int id_int;
353 if (id->GetAsString(&id_string)) { 353 if (id->GetAsString(&id_string)) {
354 xpath += base::StringPrintf( 354 xpath += base::StringPrintf(
355 "[@name=\"%s\" or @id=\"%s\"]", id_string.c_str(), id_string.c_str()); 355 "[@name=\"%s\" or @id=\"%s\"]", id_string.c_str(), id_string.c_str());
356 } else if (id->GetAsInteger(&id_int)) { 356 } else if (id->GetAsInteger(&id_int)) {
357 xpath += base::StringPrintf("[%d]", id_int + 1); 357 xpath += base::StringPrintf("[%d]", id_int + 1);
358 } else { 358 } else {
359 return Status(kUnknownError, "invalid 'id'"); 359 return Status(kUnknownError, "invalid 'id'");
360 } 360 }
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 return status; 1053 return status;
1054 } 1054 }
1055 1055
1056 Status ExecuteTakeHeapSnapshot( 1056 Status ExecuteTakeHeapSnapshot(
1057 Session* session, 1057 Session* session,
1058 WebView* web_view, 1058 WebView* web_view,
1059 const base::DictionaryValue& params, 1059 const base::DictionaryValue& params,
1060 scoped_ptr<base::Value>* value) { 1060 scoped_ptr<base::Value>* value) {
1061 return web_view->TakeHeapSnapshot(value); 1061 return web_view->TakeHeapSnapshot(value);
1062 } 1062 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/test/run_py_tests.py ('k') | chrome/test/data/chromedriver/nested_frameset.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698