OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_WEBELEMENT_COMMANDS_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_ |
6 #define CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_ | 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_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 #include "chrome/test/webdriver/web_element_id.h" | 12 #include "chrome/test/webdriver/web_element_id.h" |
13 | 13 |
14 class DictionaryValue; | 14 class DictionaryValue; |
15 | 15 |
16 namespace gfx { | |
17 class Point; | |
18 } | |
19 | |
16 namespace webdriver { | 20 namespace webdriver { |
17 | 21 |
22 class Error; | |
18 class Response; | 23 class Response; |
19 | 24 |
20 // Handles commands that interact with a web element in the WebDriver REST | 25 // Handles commands that interact with a web element in the WebDriver REST |
21 // service. | 26 // service. |
22 class WebElementCommand : public WebDriverCommand { | 27 class WebElementCommand : public WebDriverCommand { |
23 public: | 28 public: |
24 WebElementCommand(const std::vector<std::string>& path_segments, | 29 WebElementCommand(const std::vector<std::string>& path_segments, |
25 const DictionaryValue* const parameters); | 30 const DictionaryValue* const parameters); |
26 virtual ~WebElementCommand(); | 31 virtual ~WebElementCommand(); |
27 | 32 |
28 virtual bool Init(Response* const response); | 33 virtual bool Init(Response* const response); |
29 | 34 |
30 protected: | 35 protected: |
36 Error* GetAttribute(const std::string& key, Value** value) const; | |
kkania
2011/05/27 20:48:47
put this and the following function in Session ins
nodchip
2011/05/30 04:51:45
Done.
| |
37 | |
38 // Gets a clickable location of the given element. It will be the center | |
39 // location of the element. | |
40 Error* GetClickableLocation(gfx::Point* location) const; | |
41 | |
31 const std::vector<std::string>& path_segments_; | 42 const std::vector<std::string>& path_segments_; |
32 WebElementId element; | 43 WebElementId element; |
33 | 44 |
34 private: | 45 private: |
35 DISALLOW_COPY_AND_ASSIGN(WebElementCommand); | 46 DISALLOW_COPY_AND_ASSIGN(WebElementCommand); |
36 }; | 47 }; |
37 | 48 |
38 // Retrieves element attributes. | 49 // Retrieves element attributes. |
39 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/attribute/:name | 50 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/attribute/:name |
40 class ElementAttributeCommand : public WebElementCommand { | 51 class ElementAttributeCommand : public WebElementCommand { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 ElementValueCommand(const std::vector<std::string>& path_segments, | 253 ElementValueCommand(const std::vector<std::string>& path_segments, |
243 DictionaryValue* parameters); | 254 DictionaryValue* parameters); |
244 virtual ~ElementValueCommand(); | 255 virtual ~ElementValueCommand(); |
245 | 256 |
246 virtual bool DoesGet(); | 257 virtual bool DoesGet(); |
247 virtual bool DoesPost(); | 258 virtual bool DoesPost(); |
248 virtual void ExecuteGet(Response* const response); | 259 virtual void ExecuteGet(Response* const response); |
249 virtual void ExecutePost(Response* const response); | 260 virtual void ExecutePost(Response* const response); |
250 | 261 |
251 private: | 262 private: |
263 // Returns whether the element has a given attribute pair. | |
264 Error* HasAttribute(const std::string& key, const std::string& value, | |
265 bool* result) const; | |
266 Error* DragAndDropFilePaths() const; | |
267 Error* SendKeys() const; | |
268 | |
252 DISALLOW_COPY_AND_ASSIGN(ElementValueCommand); | 269 DISALLOW_COPY_AND_ASSIGN(ElementValueCommand); |
253 }; | 270 }; |
254 | 271 |
255 // Gets the visible text of the specified web element. | 272 // Gets the visible text of the specified web element. |
256 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/text | 273 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/text |
257 class ElementTextCommand : public WebElementCommand { | 274 class ElementTextCommand : public WebElementCommand { |
258 public: | 275 public: |
259 ElementTextCommand(const std::vector<std::string>& path_segments, | 276 ElementTextCommand(const std::vector<std::string>& path_segments, |
260 DictionaryValue* parameters); | 277 DictionaryValue* parameters); |
261 virtual ~ElementTextCommand(); | 278 virtual ~ElementTextCommand(); |
262 | 279 |
263 virtual bool DoesGet(); | 280 virtual bool DoesGet(); |
264 virtual void ExecuteGet(Response* const response); | 281 virtual void ExecuteGet(Response* const response); |
265 | 282 |
266 private: | 283 private: |
267 DISALLOW_COPY_AND_ASSIGN(ElementTextCommand); | 284 DISALLOW_COPY_AND_ASSIGN(ElementTextCommand); |
268 }; | 285 }; |
269 | 286 |
270 } // namespace webdriver | 287 } // namespace webdriver |
271 | 288 |
272 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_ | 289 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_ |
OLD | NEW |