OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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/webdriver_command.h" | |
12 | |
13 namespace webdriver { | |
14 | |
15 class Response; | |
16 | |
17 // Base class for searching a page, this class can find either a single | |
18 // webelement or return multiple matches. | |
19 class FindElementCommand : public WebDriverCommand { | |
20 public: | |
21 FindElementCommand(const std::vector<std::string>& path_segments, | |
22 const DictionaryValue* const parameters, | |
23 const bool find_one_element); | |
24 virtual ~FindElementCommand(); | |
25 | |
26 virtual bool DoesPost() OVERRIDE; | |
27 virtual void ExecutePost(Response* const response) OVERRIDE; | |
28 | |
29 private: | |
30 const bool find_one_element_; | |
31 std::string root_element_id_; | |
32 std::string use_; | |
33 std::string value_; | |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(FindElementCommand); | |
36 }; | |
37 | |
38 // Search for an element on the page, starting from the document root. | |
39 // The located element will be returned as a WebElement JSON object. See: | |
40 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/element | |
41 class FindOneElementCommand : public FindElementCommand { | |
42 public: | |
43 FindOneElementCommand(const std::vector<std::string>& path_segments, | |
44 const DictionaryValue* const parameters) | |
45 : FindElementCommand(path_segments, parameters, true) {} | |
46 virtual ~FindOneElementCommand() {} | |
47 | |
48 private: | |
49 DISALLOW_COPY_AND_ASSIGN(FindOneElementCommand); | |
50 }; | |
51 | |
52 // Search for multiple elements on the page, starting from the identified | |
53 // element. The located elements will be returned as a WebElement JSON | |
54 // objects. See: | |
55 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/elements | |
56 class FindManyElementsCommand : public FindElementCommand { | |
57 public: | |
58 FindManyElementsCommand(const std::vector<std::string>& path_segments, | |
59 const DictionaryValue* const parameters) | |
60 : FindElementCommand(path_segments, parameters, false) {} | |
61 virtual ~FindManyElementsCommand() {} | |
62 | |
63 private: | |
64 DISALLOW_COPY_AND_ASSIGN(FindManyElementsCommand); | |
65 }; | |
66 | |
67 } // namespace webdriver | |
68 | |
69 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_FIND_ELEMENT_COMMANDS_H_ | |
OLD | NEW |