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_WINDOW_COMMANDS_H_
6 #define CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
14 class DictionaryValue
;
22 typedef base::Callback
<Status(
25 const base::DictionaryValue
&,
26 scoped_ptr
<base::Value
>*)> WindowCommand
;
28 // Execute a Window Command on the target window.
29 Status
ExecuteWindowCommand(
30 const WindowCommand
& command
,
32 const base::DictionaryValue
& params
,
33 scoped_ptr
<base::Value
>* value
);
39 const base::DictionaryValue
& params
,
40 scoped_ptr
<base::Value
>* value
);
42 // Evaluates a given synchronous script with arguments.
43 Status
ExecuteExecuteScript(
46 const base::DictionaryValue
& params
,
47 scoped_ptr
<base::Value
>* value
);
49 // Evaluates a given asynchronous script with arguments.
50 Status
ExecuteExecuteAsyncScript(
53 const base::DictionaryValue
& params
,
54 scoped_ptr
<base::Value
>* value
);
56 // Changes the targeted frame for the given session.
57 Status
ExecuteSwitchToFrame(
60 const base::DictionaryValue
& params
,
61 scoped_ptr
<base::Value
>* value
);
63 // Change focus to the parent frame.
64 Status
ExecuteSwitchToParentFrame(
67 const base::DictionaryValue
& params
,
68 scoped_ptr
<base::Value
>* value
);
70 // Get the current page title.
71 Status
ExecuteGetTitle(
74 const base::DictionaryValue
& params
,
75 scoped_ptr
<base::Value
>* value
);
77 // Get the current page source.
78 Status
ExecuteGetPageSource(
81 const base::DictionaryValue
& params
,
82 scoped_ptr
<base::Value
>* value
);
84 // Search for an element on the page, starting from the document root.
85 Status
ExecuteFindElement(
89 const base::DictionaryValue
& params
,
90 scoped_ptr
<base::Value
>* value
);
92 // Search for multiple elements on the page, starting from the document root.
93 Status
ExecuteFindElements(
97 const base::DictionaryValue
& params
,
98 scoped_ptr
<base::Value
>* value
);
100 // Get the current page url.
101 Status
ExecuteGetCurrentUrl(
104 const base::DictionaryValue
& params
,
105 scoped_ptr
<base::Value
>* value
);
107 // Navigate backward in the browser history.
108 Status
ExecuteGoBack(
111 const base::DictionaryValue
& params
,
112 scoped_ptr
<base::Value
>* value
);
114 // Navigate forward in the browser history.
115 Status
ExecuteGoForward(
118 const base::DictionaryValue
& params
,
119 scoped_ptr
<base::Value
>* value
);
121 // Refresh the current page.
122 Status
ExecuteRefresh(
125 const base::DictionaryValue
& params
,
126 scoped_ptr
<base::Value
>* value
);
128 // Move the mouse by an offset of the element if specified .
129 Status
ExecuteMouseMoveTo(
132 const base::DictionaryValue
& params
,
133 scoped_ptr
<base::Value
>* value
);
135 // Click a mouse button at the coordinates set by the last moveto.
136 Status
ExecuteMouseClick(
139 const base::DictionaryValue
& params
,
140 scoped_ptr
<base::Value
>* value
);
142 // Click and hold a mouse button at the coordinates set by the last moveto.
143 Status
ExecuteMouseButtonDown(
146 const base::DictionaryValue
& params
,
147 scoped_ptr
<base::Value
>* value
);
149 // Releases the mouse button previously held (where the mouse is currently at).
150 Status
ExecuteMouseButtonUp(
153 const base::DictionaryValue
& params
,
154 scoped_ptr
<base::Value
>* value
);
156 // Double-clicks at the current mouse coordinates (set by last moveto).
157 Status
ExecuteMouseDoubleClick(
160 const base::DictionaryValue
& params
,
161 scoped_ptr
<base::Value
>* value
);
163 // Touch press at a given coordinate.
164 Status
ExecuteTouchDown(
167 const base::DictionaryValue
& params
,
168 scoped_ptr
<base::Value
>* value
);
170 // Touch release at a given coordinate.
171 Status
ExecuteTouchUp(
174 const base::DictionaryValue
& params
,
175 scoped_ptr
<base::Value
>* value
);
177 // Touch move at a given coordinate.
178 Status
ExecuteTouchMove(
181 const base::DictionaryValue
& params
,
182 scoped_ptr
<base::Value
>* value
);
184 Status
ExecuteGetActiveElement(
187 const base::DictionaryValue
& params
,
188 scoped_ptr
<base::Value
>* value
);
190 // Send a sequence of key strokes to the active element.
191 Status
ExecuteSendKeysToActiveElement(
194 const base::DictionaryValue
& params
,
195 scoped_ptr
<base::Value
>* value
);
197 // Gets the status of the application cache (window.applicationCache.status).
198 Status
ExecuteGetAppCacheStatus(
201 const base::DictionaryValue
& params
,
202 scoped_ptr
<base::Value
>* value
);
204 Status
ExecuteIsBrowserOnline(
207 const base::DictionaryValue
& params
,
208 scoped_ptr
<base::Value
>* value
);
210 Status
ExecuteGetStorageItem(
214 const base::DictionaryValue
& params
,
215 scoped_ptr
<base::Value
>* value
);
217 Status
ExecuteGetStorageKeys(
221 const base::DictionaryValue
& params
,
222 scoped_ptr
<base::Value
>* value
);
224 Status
ExecuteSetStorageItem(
228 const base::DictionaryValue
& params
,
229 scoped_ptr
<base::Value
>* value
);
231 Status
ExecuteRemoveStorageItem(
235 const base::DictionaryValue
& params
,
236 scoped_ptr
<base::Value
>* value
);
238 Status
ExecuteClearStorage(
242 const base::DictionaryValue
& params
,
243 scoped_ptr
<base::Value
>* value
);
245 Status
ExecuteGetStorageSize(
249 const base::DictionaryValue
& params
,
250 scoped_ptr
<base::Value
>* value
);
252 Status
ExecuteScreenshot(
255 const base::DictionaryValue
& params
,
256 scoped_ptr
<base::Value
>* value
);
258 // Retrieve all cookies visible to the current page.
259 Status
ExecuteGetCookies(
262 const base::DictionaryValue
& params
,
263 scoped_ptr
<base::Value
>* value
);
265 // Set a cookie. If the cookie path is not specified, it should be set to "/".
266 // If the domain is omitted, it should default to the current page's domain.
267 Status
ExecuteAddCookie(
270 const base::DictionaryValue
& params
,
271 scoped_ptr
<base::Value
>* value
);
273 // Delete the cookie with the given name if it exists in the current page.
274 Status
ExecuteDeleteCookie(
277 const base::DictionaryValue
& params
,
278 scoped_ptr
<base::Value
>* value
);
280 // Delete all cookies visible to the current page.
281 Status
ExecuteDeleteAllCookies(
284 const base::DictionaryValue
& params
,
285 scoped_ptr
<base::Value
>* value
);
287 Status
ExecuteSetLocation(
290 const base::DictionaryValue
& params
,
291 scoped_ptr
<base::Value
>* value
);
293 Status
ExecuteTakeHeapSnapshot(
296 const base::DictionaryValue
& params
,
297 scoped_ptr
<base::Value
>* value
);
299 #endif // CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_