diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-26 15:23:59 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-26 15:23:59 +0000 |
commit | 6c55b1de28933d6cc50069cb5f5c524b97882fa8 (patch) | |
tree | 1ba6706f112420f99a585b4f490bfd53b44887a7 /chrome/test/webdriver/session.cc | |
parent | d8be74ec121d0ea5431e8b7c6dd04450e0394d33 (diff) | |
download | chromium_src-6c55b1de28933d6cc50069cb5f5c524b97882fa8.zip chromium_src-6c55b1de28933d6cc50069cb5f5c524b97882fa8.tar.gz chromium_src-6c55b1de28933d6cc50069cb5f5c524b97882fa8.tar.bz2 |
Several bug fixes for the ChromeDriver:
- Should be able to focus on a frame using its frame element, not just
an ID, name, or index.
- Element equality checks now work properly
- Session-level command handlers should be registered with mongoose after
the element handlers to avoid clashes from greedy wildcard matching.
- Remove spam from test logs by returning 204 on favicon requests instead of
returning 404.
This change also updates src/third_party/webdriver/python to r11767.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6723004
Patch from Jason Leyba <jleyba@chromium.org>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/webdriver/session.cc')
-rw-r--r-- | chrome/test/webdriver/session.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/chrome/test/webdriver/session.cc b/chrome/test/webdriver/session.cc index 39bcd86..9d9ed9e 100644 --- a/chrome/test/webdriver/session.cc +++ b/chrome/test/webdriver/session.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/test/webdriver/session_manager.h" +#include "chrome/test/webdriver/session.h" #include <sstream> #include <vector> @@ -476,6 +476,29 @@ ErrorCode Session::SwitchToFrameWithIndex(int index) { return SwitchToFrameWithJavaScriptLocatedFrame(script, &args); } +ErrorCode Session::SwitchToFrameWithElement(const WebElementId& element) { + // TODO(jleyba): Extract this, and the other frame switch methods to an atom. + std::string script = + "var element = arguments[0];" + "console.info('Attempting to switch to ' + element);" + "if (element.nodeType != 1 || !/^i?frame$/i.test(element.tagName)) {" + " console.info('Element is not a frame: ' + element + " + "' {nodeType:' + element.nodeType + ',tagName:' + element.tagName + '}');" + " return null;" + "}" + "for (var i = 0; i < window.frames.length; i++) {" + " if (element.contentWindow == window.frames[i]) {" + " return '(//iframe|//frame)[' + (i + 1) + ']';" + " }" + "}" + "console.info('Frame is not connected to this DOM tree');" + "return null;"; + + ListValue args; + args.Append(element.ToValue()); + return SwitchToFrameWithJavaScriptLocatedFrame(script, &args); +} + void Session::SwitchToTopFrame() { current_target_.frame_path = FramePath(); } |