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_
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
14 class DictionaryValue
;
22 typedef base::Callback
<Status(
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
,
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(
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(
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(
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(
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(
75 const std::string
& element_id
,
76 const base::DictionaryValue
& params
,
77 scoped_ptr
<base::Value
>* value
);
79 // Double tap on the element.
80 Status
ExecuteTouchDoubleTap(
83 const std::string
& element_id
,
84 const base::DictionaryValue
& params
,
85 scoped_ptr
<base::Value
>* value
);
87 // Long press on the element.
88 Status
ExecuteTouchLongPress(
91 const std::string
& element_id
,
92 const base::DictionaryValue
& params
,
93 scoped_ptr
<base::Value
>* value
);
95 // Touch flick starting on the element.
99 const std::string
& element_id
,
100 const base::DictionaryValue
& params
,
101 scoped_ptr
<base::Value
>* value
);
103 // Clear a TEXTAREA or text INPUT element's value.
104 Status
ExecuteClearElement(
107 const std::string
& element_id
,
108 const base::DictionaryValue
& params
,
109 scoped_ptr
<base::Value
>* value
);
111 // Send a sequence of key strokes to an element.
112 Status
ExecuteSendKeysToElement(
115 const std::string
& element_id
,
116 const base::DictionaryValue
& params
,
117 scoped_ptr
<base::Value
>* value
);
119 // Submit a form element.
120 Status
ExecuteSubmitElement(
123 const std::string
& element_id
,
124 const base::DictionaryValue
& params
,
125 scoped_ptr
<base::Value
>* value
);
127 // Returns the text of a given element.
128 Status
ExecuteGetElementText(
131 const std::string
& element_id
,
132 const base::DictionaryValue
& params
,
133 scoped_ptr
<base::Value
>* value
);
135 // Returns the value of a given element.
136 Status
ExecuteGetElementValue(
139 const std::string
& element_id
,
140 const base::DictionaryValue
& params
,
141 scoped_ptr
<base::Value
>* value
);
143 // Returns the lower case tag name of a given element.
144 Status
ExecuteGetElementTagName(
147 const std::string
& element_id
,
148 const base::DictionaryValue
& params
,
149 scoped_ptr
<base::Value
>* value
);
151 Status
ExecuteIsElementSelected(
154 const std::string
& element_id
,
155 const base::DictionaryValue
& params
,
156 scoped_ptr
<base::Value
>* value
);
158 Status
ExecuteIsElementEnabled(
161 const std::string
& element_id
,
162 const base::DictionaryValue
& params
,
163 scoped_ptr
<base::Value
>* value
);
165 Status
ExecuteIsElementDisplayed(
168 const std::string
& element_id
,
169 const base::DictionaryValue
& params
,
170 scoped_ptr
<base::Value
>* value
);
172 // Returns the location of a given element in page coordinates.
173 Status
ExecuteGetElementLocation(
176 const std::string
& element_id
,
177 const base::DictionaryValue
& params
,
178 scoped_ptr
<base::Value
>* value
);
180 // Returns the location of a given element in client coordinates, after
181 // scrolling it into view.
182 Status
ExecuteGetElementLocationOnceScrolledIntoView(
185 const std::string
& element_id
,
186 const base::DictionaryValue
& params
,
187 scoped_ptr
<base::Value
>* value
);
189 Status
ExecuteGetElementSize(
192 const std::string
& element_id
,
193 const base::DictionaryValue
& params
,
194 scoped_ptr
<base::Value
>* value
);
196 Status
ExecuteGetElementAttribute(
199 const std::string
& element_id
,
200 const base::DictionaryValue
& params
,
201 scoped_ptr
<base::Value
>* value
);
203 // Returns the effective style for a given property of the specified element.
204 Status
ExecuteGetElementValueOfCSSProperty(
207 const std::string
& element_id
,
208 const base::DictionaryValue
& params
,
209 scoped_ptr
<base::Value
>* value
);
211 // Returns whether the two given elements are equivalent.
212 Status
ExecuteElementEquals(
215 const std::string
& element_id
,
216 const base::DictionaryValue
& params
,
217 scoped_ptr
<base::Value
>* value
);
219 #endif // CHROME_TEST_CHROMEDRIVER_ELEMENT_COMMANDS_H_