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_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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 private: | 41 private: |
42 DISALLOW_COPY_AND_ASSIGN(WebElementCommand); | 42 DISALLOW_COPY_AND_ASSIGN(WebElementCommand); |
43 }; | 43 }; |
44 | 44 |
45 // Retrieves element attributes. | 45 // Retrieves element attributes. |
46 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/attribute/:name | 46 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/attribute/:name |
47 class ElementAttributeCommand : public WebElementCommand { | 47 class ElementAttributeCommand : public WebElementCommand { |
48 public: | 48 public: |
49 ElementAttributeCommand(const std::vector<std::string>& path_segments, | 49 ElementAttributeCommand(const std::vector<std::string>& path_segments, |
50 base::DictionaryValue* parameters); | 50 const base::DictionaryValue* parameters); |
51 virtual ~ElementAttributeCommand(); | 51 virtual ~ElementAttributeCommand(); |
52 | 52 |
53 virtual bool DoesGet() OVERRIDE; | 53 virtual bool DoesGet() OVERRIDE; |
54 virtual void ExecuteGet(Response* const response) OVERRIDE; | 54 virtual void ExecuteGet(Response* const response) OVERRIDE; |
55 | 55 |
56 private: | 56 private: |
57 DISALLOW_COPY_AND_ASSIGN(ElementAttributeCommand); | 57 DISALLOW_COPY_AND_ASSIGN(ElementAttributeCommand); |
58 }; | 58 }; |
59 | 59 |
60 // Clears test input elements. | 60 // Clears test input elements. |
61 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/clear | 61 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/clear |
62 class ElementClearCommand : public WebElementCommand { | 62 class ElementClearCommand : public WebElementCommand { |
63 public: | 63 public: |
64 ElementClearCommand(const std::vector<std::string>& path_segments, | 64 ElementClearCommand(const std::vector<std::string>& path_segments, |
65 base::DictionaryValue* parameters); | 65 const base::DictionaryValue* parameters); |
66 virtual ~ElementClearCommand(); | 66 virtual ~ElementClearCommand(); |
67 | 67 |
68 virtual bool DoesPost() OVERRIDE; | 68 virtual bool DoesPost() OVERRIDE; |
69 virtual void ExecutePost(Response* const response) OVERRIDE; | 69 virtual void ExecutePost(Response* const response) OVERRIDE; |
70 | 70 |
71 private: | 71 private: |
72 DISALLOW_COPY_AND_ASSIGN(ElementClearCommand); | 72 DISALLOW_COPY_AND_ASSIGN(ElementClearCommand); |
73 }; | 73 }; |
74 | 74 |
75 // Retrieves element style properties. | 75 // Retrieves element style properties. |
76 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/css/:propertyName | 76 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/css/:propertyName |
77 class ElementCssCommand : public WebElementCommand { | 77 class ElementCssCommand : public WebElementCommand { |
78 public: | 78 public: |
79 ElementCssCommand(const std::vector<std::string>& path_segments, | 79 ElementCssCommand(const std::vector<std::string>& path_segments, |
80 base::DictionaryValue* parameters); | 80 const base::DictionaryValue* parameters); |
81 virtual ~ElementCssCommand(); | 81 virtual ~ElementCssCommand(); |
82 | 82 |
83 virtual bool DoesGet() OVERRIDE; | 83 virtual bool DoesGet() OVERRIDE; |
84 virtual void ExecuteGet(Response* const response) OVERRIDE; | 84 virtual void ExecuteGet(Response* const response) OVERRIDE; |
85 | 85 |
86 private: | 86 private: |
87 DISALLOW_COPY_AND_ASSIGN(ElementCssCommand); | 87 DISALLOW_COPY_AND_ASSIGN(ElementCssCommand); |
88 }; | 88 }; |
89 | 89 |
90 // Queries whether an element is currently displayed ot the user. | 90 // Queries whether an element is currently displayed ot the user. |
91 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/displayed | 91 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/displayed |
92 class ElementDisplayedCommand : public WebElementCommand { | 92 class ElementDisplayedCommand : public WebElementCommand { |
93 public: | 93 public: |
94 ElementDisplayedCommand(const std::vector<std::string>& path_segments, | 94 ElementDisplayedCommand(const std::vector<std::string>& path_segments, |
95 base::DictionaryValue* parameters); | 95 const base::DictionaryValue* parameters); |
96 virtual ~ElementDisplayedCommand(); | 96 virtual ~ElementDisplayedCommand(); |
97 | 97 |
98 virtual bool DoesGet() OVERRIDE; | 98 virtual bool DoesGet() OVERRIDE; |
99 virtual void ExecuteGet(Response* const response) OVERRIDE; | 99 virtual void ExecuteGet(Response* const response) OVERRIDE; |
100 | 100 |
101 private: | 101 private: |
102 DISALLOW_COPY_AND_ASSIGN(ElementDisplayedCommand); | 102 DISALLOW_COPY_AND_ASSIGN(ElementDisplayedCommand); |
103 }; | 103 }; |
104 | 104 |
105 // Queries whether an element is currently enabled. | 105 // Queries whether an element is currently enabled. |
106 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/enabled | 106 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/enabled |
107 class ElementEnabledCommand : public WebElementCommand { | 107 class ElementEnabledCommand : public WebElementCommand { |
108 public: | 108 public: |
109 ElementEnabledCommand(const std::vector<std::string>& path_segments, | 109 ElementEnabledCommand(const std::vector<std::string>& path_segments, |
110 base::DictionaryValue* parameters); | 110 const base::DictionaryValue* parameters); |
111 virtual ~ElementEnabledCommand(); | 111 virtual ~ElementEnabledCommand(); |
112 | 112 |
113 virtual bool DoesGet() OVERRIDE; | 113 virtual bool DoesGet() OVERRIDE; |
114 virtual void ExecuteGet(Response* const response) OVERRIDE; | 114 virtual void ExecuteGet(Response* const response) OVERRIDE; |
115 | 115 |
116 private: | 116 private: |
117 DISALLOW_COPY_AND_ASSIGN(ElementEnabledCommand); | 117 DISALLOW_COPY_AND_ASSIGN(ElementEnabledCommand); |
118 }; | 118 }; |
119 | 119 |
120 // Queries whether two elements are equal. | 120 // Queries whether two elements are equal. |
121 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/equals/:other | 121 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/equals/:other |
122 class ElementEqualsCommand : public WebElementCommand { | 122 class ElementEqualsCommand : public WebElementCommand { |
123 public: | 123 public: |
124 ElementEqualsCommand(const std::vector<std::string>& path_segments, | 124 ElementEqualsCommand(const std::vector<std::string>& path_segments, |
125 base::DictionaryValue* parameters); | 125 const base::DictionaryValue* parameters); |
126 virtual ~ElementEqualsCommand(); | 126 virtual ~ElementEqualsCommand(); |
127 | 127 |
128 virtual bool DoesGet() OVERRIDE; | 128 virtual bool DoesGet() OVERRIDE; |
129 virtual void ExecuteGet(Response* const response) OVERRIDE; | 129 virtual void ExecuteGet(Response* const response) OVERRIDE; |
130 | 130 |
131 private: | 131 private: |
132 DISALLOW_COPY_AND_ASSIGN(ElementEqualsCommand); | 132 DISALLOW_COPY_AND_ASSIGN(ElementEqualsCommand); |
133 }; | 133 }; |
134 | 134 |
135 // Retrieves the element's location on the page. | 135 // Retrieves the element's location on the page. |
136 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/location | 136 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/location |
137 class ElementLocationCommand : public WebElementCommand { | 137 class ElementLocationCommand : public WebElementCommand { |
138 public: | 138 public: |
139 ElementLocationCommand(const std::vector<std::string>& path_segments, | 139 ElementLocationCommand(const std::vector<std::string>& path_segments, |
140 base::DictionaryValue* parameters); | 140 const base::DictionaryValue* parameters); |
141 virtual ~ElementLocationCommand(); | 141 virtual ~ElementLocationCommand(); |
142 | 142 |
143 virtual bool DoesGet() OVERRIDE; | 143 virtual bool DoesGet() OVERRIDE; |
144 virtual void ExecuteGet(Response* const response) OVERRIDE; | 144 virtual void ExecuteGet(Response* const response) OVERRIDE; |
145 | 145 |
146 private: | 146 private: |
147 DISALLOW_COPY_AND_ASSIGN(ElementLocationCommand); | 147 DISALLOW_COPY_AND_ASSIGN(ElementLocationCommand); |
148 }; | 148 }; |
149 | 149 |
150 // Retrieves the element's location on the page after ensuring it is visible in | 150 // Retrieves the element's location on the page after ensuring it is visible in |
151 // the current viewport. | 151 // the current viewport. |
152 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/location_in_view | 152 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/location_in_view |
153 class ElementLocationInViewCommand : public WebElementCommand { | 153 class ElementLocationInViewCommand : public WebElementCommand { |
154 public: | 154 public: |
155 ElementLocationInViewCommand(const std::vector<std::string>& path_segments, | 155 ElementLocationInViewCommand(const std::vector<std::string>& path_segments, |
156 base::DictionaryValue* parameters); | 156 const base::DictionaryValue* parameters); |
157 virtual ~ElementLocationInViewCommand(); | 157 virtual ~ElementLocationInViewCommand(); |
158 | 158 |
159 virtual bool DoesGet() OVERRIDE; | 159 virtual bool DoesGet() OVERRIDE; |
160 virtual void ExecuteGet(Response* const response) OVERRIDE; | 160 virtual void ExecuteGet(Response* const response) OVERRIDE; |
161 | 161 |
162 private: | 162 private: |
163 DISALLOW_COPY_AND_ASSIGN(ElementLocationInViewCommand); | 163 DISALLOW_COPY_AND_ASSIGN(ElementLocationInViewCommand); |
164 }; | 164 }; |
165 | 165 |
166 // Queries for an element's tag name. | 166 // Queries for an element's tag name. |
167 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/name | 167 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/name |
168 class ElementNameCommand : public WebElementCommand { | 168 class ElementNameCommand : public WebElementCommand { |
169 public: | 169 public: |
170 ElementNameCommand(const std::vector<std::string>& path_segments, | 170 ElementNameCommand(const std::vector<std::string>& path_segments, |
171 base::DictionaryValue* parameters); | 171 const base::DictionaryValue* parameters); |
172 virtual ~ElementNameCommand(); | 172 virtual ~ElementNameCommand(); |
173 | 173 |
174 virtual bool DoesGet() OVERRIDE; | 174 virtual bool DoesGet() OVERRIDE; |
175 virtual void ExecuteGet(Response* const response) OVERRIDE; | 175 virtual void ExecuteGet(Response* const response) OVERRIDE; |
176 | 176 |
177 private: | 177 private: |
178 DISALLOW_COPY_AND_ASSIGN(ElementNameCommand); | 178 DISALLOW_COPY_AND_ASSIGN(ElementNameCommand); |
179 }; | 179 }; |
180 | 180 |
181 // Handles selecting elements and querying whether they are currently selected. | 181 // Handles selecting elements and querying whether they are currently selected. |
182 // Queries whether an element is currently enabled. | 182 // Queries whether an element is currently enabled. |
183 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/selected | 183 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/selected |
184 class ElementSelectedCommand : public WebElementCommand { | 184 class ElementSelectedCommand : public WebElementCommand { |
185 public: | 185 public: |
186 ElementSelectedCommand(const std::vector<std::string>& path_segments, | 186 ElementSelectedCommand(const std::vector<std::string>& path_segments, |
187 base::DictionaryValue* parameters); | 187 const base::DictionaryValue* parameters); |
188 virtual ~ElementSelectedCommand(); | 188 virtual ~ElementSelectedCommand(); |
189 | 189 |
190 virtual bool DoesGet() OVERRIDE; | 190 virtual bool DoesGet() OVERRIDE; |
191 virtual bool DoesPost() OVERRIDE; | 191 virtual bool DoesPost() OVERRIDE; |
192 virtual void ExecuteGet(Response* const response) OVERRIDE; | 192 virtual void ExecuteGet(Response* const response) OVERRIDE; |
193 virtual void ExecutePost(Response* const response) OVERRIDE; | 193 virtual void ExecutePost(Response* const response) OVERRIDE; |
194 | 194 |
195 private: | 195 private: |
196 DISALLOW_COPY_AND_ASSIGN(ElementSelectedCommand); | 196 DISALLOW_COPY_AND_ASSIGN(ElementSelectedCommand); |
197 }; | 197 }; |
198 | 198 |
199 // Queries for an element's size. | 199 // Queries for an element's size. |
200 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/size | 200 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/size |
201 class ElementSizeCommand : public WebElementCommand { | 201 class ElementSizeCommand : public WebElementCommand { |
202 public: | 202 public: |
203 ElementSizeCommand(const std::vector<std::string>& path_segments, | 203 ElementSizeCommand(const std::vector<std::string>& path_segments, |
204 base::DictionaryValue* parameters); | 204 const base::DictionaryValue* parameters); |
205 virtual ~ElementSizeCommand(); | 205 virtual ~ElementSizeCommand(); |
206 | 206 |
207 virtual bool DoesGet() OVERRIDE; | 207 virtual bool DoesGet() OVERRIDE; |
208 virtual void ExecuteGet(Response* const response) OVERRIDE; | 208 virtual void ExecuteGet(Response* const response) OVERRIDE; |
209 | 209 |
210 private: | 210 private: |
211 DISALLOW_COPY_AND_ASSIGN(ElementSizeCommand); | 211 DISALLOW_COPY_AND_ASSIGN(ElementSizeCommand); |
212 }; | 212 }; |
213 | 213 |
214 // Submit's the form containing the target element. | 214 // Submit's the form containing the target element. |
215 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/submit | 215 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/submit |
216 class ElementSubmitCommand : public WebElementCommand { | 216 class ElementSubmitCommand : public WebElementCommand { |
217 public: | 217 public: |
218 ElementSubmitCommand(const std::vector<std::string>& path_segments, | 218 ElementSubmitCommand(const std::vector<std::string>& path_segments, |
219 base::DictionaryValue* parameters); | 219 const base::DictionaryValue* parameters); |
220 virtual ~ElementSubmitCommand(); | 220 virtual ~ElementSubmitCommand(); |
221 | 221 |
222 virtual bool DoesPost() OVERRIDE; | 222 virtual bool DoesPost() OVERRIDE; |
223 virtual void ExecutePost(Response* const response) OVERRIDE; | 223 virtual void ExecutePost(Response* const response) OVERRIDE; |
224 | 224 |
225 private: | 225 private: |
226 DISALLOW_COPY_AND_ASSIGN(ElementSubmitCommand); | 226 DISALLOW_COPY_AND_ASSIGN(ElementSubmitCommand); |
227 }; | 227 }; |
228 | 228 |
229 // Toggle's whether an element is selected. | 229 // Toggle's whether an element is selected. |
230 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/toggle | 230 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/toggle |
231 class ElementToggleCommand : public WebElementCommand { | 231 class ElementToggleCommand : public WebElementCommand { |
232 public: | 232 public: |
233 ElementToggleCommand(const std::vector<std::string>& path_segments, | 233 ElementToggleCommand(const std::vector<std::string>& path_segments, |
234 base::DictionaryValue* parameters); | 234 const base::DictionaryValue* parameters); |
235 virtual ~ElementToggleCommand(); | 235 virtual ~ElementToggleCommand(); |
236 | 236 |
237 virtual bool DoesPost() OVERRIDE; | 237 virtual bool DoesPost() OVERRIDE; |
238 virtual void ExecutePost(Response* const response) OVERRIDE; | 238 virtual void ExecutePost(Response* const response) OVERRIDE; |
239 | 239 |
240 private: | 240 private: |
241 DISALLOW_COPY_AND_ASSIGN(ElementToggleCommand); | 241 DISALLOW_COPY_AND_ASSIGN(ElementToggleCommand); |
242 }; | 242 }; |
243 | 243 |
244 // Sends keys to the specified web element. Also gets the value property of an | 244 // Sends keys to the specified web element. Also gets the value property of an |
245 // element. | 245 // element. |
246 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/value | 246 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/value |
247 class ElementValueCommand : public WebElementCommand { | 247 class ElementValueCommand : public WebElementCommand { |
248 public: | 248 public: |
249 ElementValueCommand(const std::vector<std::string>& path_segments, | 249 ElementValueCommand(const std::vector<std::string>& path_segments, |
250 base::DictionaryValue* parameters); | 250 const base::DictionaryValue* parameters); |
251 virtual ~ElementValueCommand(); | 251 virtual ~ElementValueCommand(); |
252 | 252 |
253 virtual bool DoesGet() OVERRIDE; | 253 virtual bool DoesGet() OVERRIDE; |
254 virtual bool DoesPost() OVERRIDE; | 254 virtual bool DoesPost() OVERRIDE; |
255 virtual void ExecuteGet(Response* const response) OVERRIDE; | 255 virtual void ExecuteGet(Response* const response) OVERRIDE; |
256 virtual void ExecutePost(Response* const response) OVERRIDE; | 256 virtual void ExecutePost(Response* const response) OVERRIDE; |
257 | 257 |
258 private: | 258 private: |
259 // Returns whether the element has a given attribute pair. | 259 // Returns whether the element has a given attribute pair. |
260 Error* HasAttributeWithLowerCaseValueASCII(const std::string& key, | 260 Error* HasAttributeWithLowerCaseValueASCII(const std::string& key, |
261 const std::string& value, | 261 const std::string& value, |
262 bool* result) const; | 262 bool* result) const; |
263 Error* DragAndDropFilePaths() const; | 263 Error* DragAndDropFilePaths() const; |
264 Error* SendKeys() const; | 264 Error* SendKeys() const; |
265 | 265 |
266 DISALLOW_COPY_AND_ASSIGN(ElementValueCommand); | 266 DISALLOW_COPY_AND_ASSIGN(ElementValueCommand); |
267 }; | 267 }; |
268 | 268 |
269 // Gets the visible text of the specified web element. | 269 // Gets the visible text of the specified web element. |
270 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/text | 270 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e
lement/:id/text |
271 class ElementTextCommand : public WebElementCommand { | 271 class ElementTextCommand : public WebElementCommand { |
272 public: | 272 public: |
273 ElementTextCommand(const std::vector<std::string>& path_segments, | 273 ElementTextCommand(const std::vector<std::string>& path_segments, |
274 base::DictionaryValue* parameters); | 274 const base::DictionaryValue* parameters); |
275 virtual ~ElementTextCommand(); | 275 virtual ~ElementTextCommand(); |
276 | 276 |
277 virtual bool DoesGet() OVERRIDE; | 277 virtual bool DoesGet() OVERRIDE; |
278 virtual void ExecuteGet(Response* const response) OVERRIDE; | 278 virtual void ExecuteGet(Response* const response) OVERRIDE; |
279 | 279 |
280 private: | 280 private: |
281 DISALLOW_COPY_AND_ASSIGN(ElementTextCommand); | 281 DISALLOW_COPY_AND_ASSIGN(ElementTextCommand); |
282 }; | 282 }; |
283 | 283 |
284 } // namespace webdriver | 284 } // namespace webdriver |
285 | 285 |
286 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_ | 286 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_ |
OLD | NEW |