1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_
#define CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_
#include <string>
#include <vector>
#include "chrome/test/webdriver/commands/webdriver_command.h"
#include "chrome/test/webdriver/web_element_id.h"
class DictionaryValue;
namespace webdriver {
class Response;
// Handles commands that interact with a web element in the WebDriver REST
// service.
class WebElementCommand : public WebDriverCommand {
public:
WebElementCommand(const std::vector<std::string>& path_segments,
const DictionaryValue* const parameters);
virtual ~WebElementCommand();
virtual bool Init(Response* const response);
protected:
bool GetElementSize(int* width, int* height);
const std::vector<std::string>& path_segments_;
WebElementId element;
private:
DISALLOW_COPY_AND_ASSIGN(WebElementCommand);
};
// Retrieves element attributes.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/attribute/:name
class ElementAttributeCommand : public WebElementCommand {
public:
ElementAttributeCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementAttributeCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementAttributeCommand);
};
// Clears test input elements.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/clear
class ElementClearCommand : public WebElementCommand {
public:
ElementClearCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementClearCommand();
virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementClearCommand);
};
// Retrieves element style properties.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/css/:propertyName
class ElementCssCommand : public WebElementCommand {
public:
ElementCssCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementCssCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementCssCommand);
};
// Queries whether an element is currently displayed ot the user.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/displayed
class ElementDisplayedCommand : public WebElementCommand {
public:
ElementDisplayedCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementDisplayedCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementDisplayedCommand);
};
// Queries whether an element is currently enabled.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/enabled
class ElementEnabledCommand : public WebElementCommand {
public:
ElementEnabledCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementEnabledCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementEnabledCommand);
};
// Queries whether two elements are equal.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/equals/:other
class ElementEqualsCommand : public WebElementCommand {
public:
ElementEqualsCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementEqualsCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementEqualsCommand);
};
// Retrieves the element's location on the page.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/location
class ElementLocationCommand : public WebElementCommand {
public:
ElementLocationCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementLocationCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementLocationCommand);
};
// Retrieves the element's location on the page after ensuring it is visible in
// the current viewport.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/location_in_view
class ElementLocationInViewCommand : public WebElementCommand {
public:
ElementLocationInViewCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementLocationInViewCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementLocationInViewCommand);
};
// Queries for an element's tag name.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/name
class ElementNameCommand : public WebElementCommand {
public:
ElementNameCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementNameCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementNameCommand);
};
// Handles selecting elements and querying whether they are currently selected.
// Queries whether an element is currently enabled.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/selected
class ElementSelectedCommand : public WebElementCommand {
public:
ElementSelectedCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementSelectedCommand();
virtual bool DoesGet();
virtual bool DoesPost();
virtual void ExecuteGet(Response* const response);
virtual void ExecutePost(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementSelectedCommand);
};
// Queries for an element's size.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/size
class ElementSizeCommand : public WebElementCommand {
public:
ElementSizeCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementSizeCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementSizeCommand);
};
// Submit's the form containing the target element.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/submit
class ElementSubmitCommand : public WebElementCommand {
public:
ElementSubmitCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementSubmitCommand();
virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementSubmitCommand);
};
// Toggle's whether an element is selected.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/toggle
class ElementToggleCommand : public WebElementCommand {
public:
ElementToggleCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementToggleCommand();
virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementToggleCommand);
};
// Sends keys to the specified web element. Also gets the value property of an
// element.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
class ElementValueCommand : public WebElementCommand {
public:
ElementValueCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementValueCommand();
virtual bool DoesGet();
virtual bool DoesPost();
virtual void ExecuteGet(Response* const response);
virtual void ExecutePost(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementValueCommand);
};
// Gets the visible text of the specified web element.
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/text
class ElementTextCommand : public WebElementCommand {
public:
ElementTextCommand(const std::vector<std::string>& path_segments,
DictionaryValue* parameters);
virtual ~ElementTextCommand();
virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
DISALLOW_COPY_AND_ASSIGN(ElementTextCommand);
};
} // namespace webdriver
#endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBELEMENT_COMMANDS_H_
|