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

Side by Side Diff: chrome/test/webdriver/commands/find_element_commands.h

Issue 3643002: Implemnts the commands in webdriver to preform searching of elements on a page. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix for windows build Created 10 years 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/webdriver/commands/find_element_commands.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_FIND_ELEMENT_COMMANDS_H_
6 #define CHROME_TEST_WEBDRIVER_COMMANDS_FIND_ELEMENT_COMMANDS_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "chrome/test/webdriver/commands/command.h"
12 #include "chrome/test/webdriver/commands/webdriver_command.h"
13
14 namespace webdriver {
15
16 // Base class for searching a page, this class can find either a single
17 // webelement or return multiple matches.
18 class FindElementCommand : public WebDriverCommand {
19 public:
20 FindElementCommand(const std::vector<std::string>& path_segments,
21 const DictionaryValue* const parameters,
22 const bool find_one_element)
23 : WebDriverCommand(path_segments, parameters),
24 find_one_element_(find_one_element) {}
25 virtual ~FindElementCommand() {}
26
27 virtual bool Init(Response* const response);
28
29 virtual bool DoesPost() { return true; }
30 virtual void ExecutePost(Response* const response);
31
32 private:
33 virtual bool RequiresValidTab() { return false; }
34 const bool find_one_element_;
35 std::string root_element_id_;
36 std::string use_;
37 std::string value_;
38
39 DISALLOW_COPY_AND_ASSIGN(FindElementCommand);
40 };
41
42 // Search for an element on the page, starting from the document root.
43 // The located element will be returned as a WebElement JSON object. See:
44 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/element
45 class FindOneElementCommand : public FindElementCommand {
46 public:
47 FindOneElementCommand(const std::vector<std::string>& path_segments,
48 const DictionaryValue* const parameters)
49 : FindElementCommand(path_segments, parameters, true) {}
50 virtual ~FindOneElementCommand() {}
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(FindOneElementCommand);
54 };
55
56 // Search for multiple elements on the page, starting from the identified
57 // element. The located elements will be returned as a WebElement JSON
58 // objects. See:
59 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/elements
60 class FindManyElementsCommand : public FindElementCommand {
61 public:
62 FindManyElementsCommand(const std::vector<std::string>& path_segments,
63 const DictionaryValue* const parameters)
64 : FindElementCommand(path_segments, parameters, false) {}
65 virtual ~FindManyElementsCommand() {}
66
67 private:
68 DISALLOW_COPY_AND_ASSIGN(FindManyElementsCommand);
69 };
70
71 } // namespace webdriver
72
73 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_FIND_ELEMENT_COMMANDS_H_
74
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/webdriver/commands/find_element_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698