Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / test / chromedriver / element_commands.h
blob6d94bf379dc5b7c5e0cc0f4041b3b7482dea63dd
1 // Copyright (c) 2013 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.
5 #ifndef CHROME_TEST_CHROMEDRIVER_ELEMENT_COMMANDS_H_
6 #define CHROME_TEST_CHROMEDRIVER_ELEMENT_COMMANDS_H_
8 #include <string>
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace base {
14 class DictionaryValue;
15 class Value;
18 struct Session;
19 class Status;
20 class WebView;
22 typedef base::Callback<Status(
23 Session* session,
24 WebView* web_view,
25 const std::string&,
26 const base::DictionaryValue&,
27 scoped_ptr<base::Value>*)> ElementCommand;
29 // Execute a command on a specific element.
30 Status ExecuteElementCommand(
31 const ElementCommand& command,
32 Session* session,
33 WebView* web_view,
34 const base::DictionaryValue& params,
35 scoped_ptr<base::Value>* value);
37 // Search for an element on the page, starting from the given element.
38 Status ExecuteFindChildElement(
39 int interval_ms,
40 Session* session,
41 WebView* web_view,
42 const std::string& element_id,
43 const base::DictionaryValue& params,
44 scoped_ptr<base::Value>* value);
46 // Search for multiple elements on the page, starting from the given element.
47 Status ExecuteFindChildElements(
48 int interval_ms,
49 Session* session,
50 WebView* web_view,
51 const std::string& element_id,
52 const base::DictionaryValue& params,
53 scoped_ptr<base::Value>* value);
55 // Move the mouse to the given element.
56 Status ExecuteHoverOverElement(
57 Session* session,
58 WebView* web_view,
59 const std::string& element_id,
60 const base::DictionaryValue& params,
61 scoped_ptr<base::Value>* value);
63 // Click on the element.
64 Status ExecuteClickElement(
65 Session* session,
66 WebView* web_view,
67 const std::string& element_id,
68 const base::DictionaryValue& params,
69 scoped_ptr<base::Value>* value);
71 // Touch click on the element.
72 Status ExecuteTouchSingleTap(
73 Session* session,
74 WebView* web_view,
75 const std::string& element_id,
76 const base::DictionaryValue& params,
77 scoped_ptr<base::Value>* value);
79 // Touch flick starting on the element.
80 Status ExecuteFlick(
81 Session* session,
82 WebView* web_view,
83 const std::string& element_id,
84 const base::DictionaryValue& params,
85 scoped_ptr<base::Value>* value);
87 // Clear a TEXTAREA or text INPUT element's value.
88 Status ExecuteClearElement(
89 Session* session,
90 WebView* web_view,
91 const std::string& element_id,
92 const base::DictionaryValue& params,
93 scoped_ptr<base::Value>* value);
95 // Send a sequence of key strokes to an element.
96 Status ExecuteSendKeysToElement(
97 Session* session,
98 WebView* web_view,
99 const std::string& element_id,
100 const base::DictionaryValue& params,
101 scoped_ptr<base::Value>* value);
103 // Submit a form element.
104 Status ExecuteSubmitElement(
105 Session* session,
106 WebView* web_view,
107 const std::string& element_id,
108 const base::DictionaryValue& params,
109 scoped_ptr<base::Value>* value);
111 // Returns the text of a given element.
112 Status ExecuteGetElementText(
113 Session* session,
114 WebView* web_view,
115 const std::string& element_id,
116 const base::DictionaryValue& params,
117 scoped_ptr<base::Value>* value);
119 // Returns the value of a given element.
120 Status ExecuteGetElementValue(
121 Session* session,
122 WebView* web_view,
123 const std::string& element_id,
124 const base::DictionaryValue& params,
125 scoped_ptr<base::Value>* value);
127 // Returns the lower case tag name of a given element.
128 Status ExecuteGetElementTagName(
129 Session* session,
130 WebView* web_view,
131 const std::string& element_id,
132 const base::DictionaryValue& params,
133 scoped_ptr<base::Value>* value);
135 Status ExecuteIsElementSelected(
136 Session* session,
137 WebView* web_view,
138 const std::string& element_id,
139 const base::DictionaryValue& params,
140 scoped_ptr<base::Value>* value);
142 Status ExecuteIsElementEnabled(
143 Session* session,
144 WebView* web_view,
145 const std::string& element_id,
146 const base::DictionaryValue& params,
147 scoped_ptr<base::Value>* value);
149 Status ExecuteIsElementDisplayed(
150 Session* session,
151 WebView* web_view,
152 const std::string& element_id,
153 const base::DictionaryValue& params,
154 scoped_ptr<base::Value>* value);
156 // Returns the location of a given element in page coordinates.
157 Status ExecuteGetElementLocation(
158 Session* session,
159 WebView* web_view,
160 const std::string& element_id,
161 const base::DictionaryValue& params,
162 scoped_ptr<base::Value>* value);
164 // Returns the location of a given element in client coordinates, after
165 // scrolling it into view.
166 Status ExecuteGetElementLocationOnceScrolledIntoView(
167 Session* session,
168 WebView* web_view,
169 const std::string& element_id,
170 const base::DictionaryValue& params,
171 scoped_ptr<base::Value>* value);
173 Status ExecuteGetElementSize(
174 Session* session,
175 WebView* web_view,
176 const std::string& element_id,
177 const base::DictionaryValue& params,
178 scoped_ptr<base::Value>* value);
180 Status ExecuteGetElementAttribute(
181 Session* session,
182 WebView* web_view,
183 const std::string& element_id,
184 const base::DictionaryValue& params,
185 scoped_ptr<base::Value>* value);
187 // Returns the effective style for a given property of the specified element.
188 Status ExecuteGetElementValueOfCSSProperty(
189 Session* session,
190 WebView* web_view,
191 const std::string& element_id,
192 const base::DictionaryValue& params,
193 scoped_ptr<base::Value>* value);
195 // Returns whether the two given elements are equivalent.
196 Status ExecuteElementEquals(
197 Session* session,
198 WebView* web_view,
199 const std::string& element_id,
200 const base::DictionaryValue& params,
201 scoped_ptr<base::Value>* value);
203 #endif // CHROME_TEST_CHROMEDRIVER_ELEMENT_COMMANDS_H_