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