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