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 // Touch flick starting on the element.
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(
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(
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(
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(
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(
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(
131 const std::string
& element_id
,
132 const base::DictionaryValue
& params
,
133 scoped_ptr
<base::Value
>* value
);
135 Status
ExecuteIsElementSelected(
138 const std::string
& element_id
,
139 const base::DictionaryValue
& params
,
140 scoped_ptr
<base::Value
>* value
);
142 Status
ExecuteIsElementEnabled(
145 const std::string
& element_id
,
146 const base::DictionaryValue
& params
,
147 scoped_ptr
<base::Value
>* value
);
149 Status
ExecuteIsElementDisplayed(
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(
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(
169 const std::string
& element_id
,
170 const base::DictionaryValue
& params
,
171 scoped_ptr
<base::Value
>* value
);
173 Status
ExecuteGetElementSize(
176 const std::string
& element_id
,
177 const base::DictionaryValue
& params
,
178 scoped_ptr
<base::Value
>* value
);
180 Status
ExecuteGetElementAttribute(
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(
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(
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_