selenium-core-runner 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +30 -0
- data/app/controllers/selenium_core_runner/suites_controller.rb +19 -0
- data/app/views/selenium_core_runner/suites/index.html.erb +177 -0
- data/app/views/selenium_core_runner/suites/show.html.erb +0 -0
- data/config/routes.rb +6 -0
- data/lib/selenium-core-runner/engine.rb +19 -0
- data/lib/selenium-core-runner.rb +3 -0
- data/public/selenium-core-runner/Blank.html +7 -0
- data/public/selenium-core-runner/InjectedRemoteRunner.html +8 -0
- data/public/selenium-core-runner/RemoteRunner.html +101 -0
- data/public/selenium-core-runner/SeleniumLog.html +109 -0
- data/public/selenium-core-runner/TestPrompt.html +145 -0
- data/public/selenium-core-runner/TestRunner-splash.html +55 -0
- data/public/selenium-core-runner/TestRunner.hta +177 -0
- data/public/selenium-core-runner/TestRunner.html +177 -0
- data/public/selenium-core-runner/icons/all.png +0 -0
- data/public/selenium-core-runner/icons/continue.png +0 -0
- data/public/selenium-core-runner/icons/continue_disabled.png +0 -0
- data/public/selenium-core-runner/icons/pause.png +0 -0
- data/public/selenium-core-runner/icons/pause_disabled.png +0 -0
- data/public/selenium-core-runner/icons/selected.png +0 -0
- data/public/selenium-core-runner/icons/step.png +0 -0
- data/public/selenium-core-runner/icons/step_disabled.png +0 -0
- data/public/selenium-core-runner/iedoc-core.xml +1789 -0
- data/public/selenium-core-runner/iedoc.xml +1830 -0
- data/public/selenium-core-runner/lib/cssQuery/cssQuery-p.js +6 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery.js +356 -0
- data/public/selenium-core-runner/lib/prototype.js +2006 -0
- data/public/selenium-core-runner/lib/scriptaculous/builder.js +101 -0
- data/public/selenium-core-runner/lib/scriptaculous/controls.js +815 -0
- data/public/selenium-core-runner/lib/scriptaculous/dragdrop.js +915 -0
- data/public/selenium-core-runner/lib/scriptaculous/effects.js +958 -0
- data/public/selenium-core-runner/lib/scriptaculous/scriptaculous.js +47 -0
- data/public/selenium-core-runner/lib/scriptaculous/slider.js +283 -0
- data/public/selenium-core-runner/lib/scriptaculous/unittest.js +383 -0
- data/public/selenium-core-runner/lib/snapsie.js +91 -0
- data/public/selenium-core-runner/scripts/find_matching_child.js +69 -0
- data/public/selenium-core-runner/scripts/htmlutils.js +1623 -0
- data/public/selenium-core-runner/scripts/injection.html +72 -0
- data/public/selenium-core-runner/scripts/selenium-api.js +3240 -0
- data/public/selenium-core-runner/scripts/selenium-browserbot.js +2333 -0
- data/public/selenium-core-runner/scripts/selenium-browserdetect.js +153 -0
- data/public/selenium-core-runner/scripts/selenium-commandhandlers.js +379 -0
- data/public/selenium-core-runner/scripts/selenium-executionloop.js +175 -0
- data/public/selenium-core-runner/scripts/selenium-logging.js +148 -0
- data/public/selenium-core-runner/scripts/selenium-remoterunner.js +695 -0
- data/public/selenium-core-runner/scripts/selenium-testrunner.js +1362 -0
- data/public/selenium-core-runner/scripts/selenium-version.js +5 -0
- data/public/selenium-core-runner/scripts/ui-doc.html +803 -0
- data/public/selenium-core-runner/scripts/ui-element.js +1627 -0
- data/public/selenium-core-runner/scripts/ui-map-sample.js +979 -0
- data/public/selenium-core-runner/scripts/user-extensions.js +3 -0
- data/public/selenium-core-runner/scripts/user-extensions.js.sample +75 -0
- data/public/selenium-core-runner/scripts/xmlextras.js +153 -0
- data/public/selenium-core-runner/selenium-logo.png +0 -0
- data/public/selenium-core-runner/selenium-test.css +43 -0
- data/public/selenium-core-runner/selenium.css +316 -0
- data/public/selenium-core-runner/xpath/dom.js +566 -0
- data/public/selenium-core-runner/xpath/javascript-xpath-0.1.11.js +2816 -0
- data/public/selenium-core-runner/xpath/util.js +549 -0
- data/public/selenium-core-runner/xpath/xmltoken.js +149 -0
- data/public/selenium-core-runner/xpath/xpath.js +2481 -0
- metadata +121 -0
@@ -0,0 +1,1789 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
|
3
|
+
<apidoc>
|
4
|
+
|
5
|
+
<top>Defines an object that runs Selenium commands.
|
6
|
+
|
7
|
+
<h3><a name="locators"></a>Element Locators</h3>
|
8
|
+
<p>
|
9
|
+
Element Locators tell Selenium which HTML element a command refers to.
|
10
|
+
The format of a locator is:</p>
|
11
|
+
<blockquote>
|
12
|
+
<em>locatorType</em><strong>=</strong><em>argument</em>
|
13
|
+
</blockquote>
|
14
|
+
|
15
|
+
<p>
|
16
|
+
We support the following strategies for locating elements:
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<ul>
|
20
|
+
<li><strong>identifier</strong>=<em>id</em>:
|
21
|
+
Select the element with the specified @id attribute. If no match is
|
22
|
+
found, select the first element whose @name attribute is <em>id</em>.
|
23
|
+
(This is normally the default; see below.)</li>
|
24
|
+
<li><strong>id</strong>=<em>id</em>:
|
25
|
+
Select the element with the specified @id attribute.</li>
|
26
|
+
|
27
|
+
<li><strong>name</strong>=<em>name</em>:
|
28
|
+
Select the first element with the specified @name attribute.
|
29
|
+
<ul class="first last simple">
|
30
|
+
<li>username</li>
|
31
|
+
<li>name=username</li>
|
32
|
+
</ul>
|
33
|
+
|
34
|
+
<p>The name may optionally be followed by one or more <em>element-filters</em>, separated from the name by whitespace. If the <em>filterType</em> is not specified, <strong>value</strong> is assumed.</p>
|
35
|
+
|
36
|
+
<ul class="first last simple">
|
37
|
+
<li>name=flavour value=chocolate</li>
|
38
|
+
</ul>
|
39
|
+
</li>
|
40
|
+
<li><strong>dom</strong>=<em>javascriptExpression</em>:
|
41
|
+
|
42
|
+
Find an element by evaluating the specified string. This allows you to traverse the HTML Document Object
|
43
|
+
Model using JavaScript. Note that you must not return a value in this string; simply make it the last expression in the block.
|
44
|
+
<ul class="first last simple">
|
45
|
+
<li>dom=document.forms['myForm'].myDropdown</li>
|
46
|
+
<li>dom=document.images[56]</li>
|
47
|
+
<li>dom=function foo() { return document.links[1]; }; foo();</li>
|
48
|
+
</ul>
|
49
|
+
|
50
|
+
</li>
|
51
|
+
|
52
|
+
<li><strong>xpath</strong>=<em>xpathExpression</em>:
|
53
|
+
Locate an element using an XPath expression.
|
54
|
+
<ul class="first last simple">
|
55
|
+
<li>xpath=//img[@alt='The image alt text']</li>
|
56
|
+
<li>xpath=//table[@id='table1']//tr[4]/td[2]</li>
|
57
|
+
<li>xpath=//a[contains(@href,'#id1')]</li>
|
58
|
+
<li>xpath=//a[contains(@href,'#id1')]/@class</li>
|
59
|
+
<li>xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../td</li>
|
60
|
+
<li>xpath=//input[@name='name2' and @value='yes']</li>
|
61
|
+
<li>xpath=//*[text()="right"]</li>
|
62
|
+
|
63
|
+
</ul>
|
64
|
+
</li>
|
65
|
+
<li><strong>link</strong>=<em>textPattern</em>:
|
66
|
+
Select the link (anchor) element which contains text matching the
|
67
|
+
specified <em>pattern</em>.
|
68
|
+
<ul class="first last simple">
|
69
|
+
<li>link=The link text</li>
|
70
|
+
</ul>
|
71
|
+
|
72
|
+
</li>
|
73
|
+
|
74
|
+
<li><strong>css</strong>=<em>cssSelectorSyntax</em>:
|
75
|
+
Select the element using css selectors. Please refer to <a href="http://www.w3.org/TR/REC-CSS2/selector.html">CSS2 selectors</a>, <a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">CSS3 selectors</a> for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
|
76
|
+
<ul class="first last simple">
|
77
|
+
<li>css=a[href="#id3"]</li>
|
78
|
+
<li>css=span#firstChild + span</li>
|
79
|
+
</ul>
|
80
|
+
<p>Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after). </p>
|
81
|
+
</li>
|
82
|
+
|
83
|
+
<li><strong>ui</strong>=<em>uiSpecifierString</em>:
|
84
|
+
Locate an element by resolving the UI specifier string to another locator, and evaluating it. See the <a href="http://svn.openqa.org/fisheye/browse/~raw,r=trunk/selenium/trunk/src/main/resources/core/scripts/ui-doc.html">Selenium UI-Element Reference</a> for more details.
|
85
|
+
<ul class="first last simple">
|
86
|
+
<li>ui=loginPages::loginButton()</li>
|
87
|
+
<li>ui=settingsPages::toggle(label=Hide Email)</li>
|
88
|
+
<li>ui=forumPages::postBody(index=2)//a[2]</li>
|
89
|
+
</ul>
|
90
|
+
</li>
|
91
|
+
|
92
|
+
</ul>
|
93
|
+
|
94
|
+
<p>
|
95
|
+
Without an explicit locator prefix, Selenium uses the following default
|
96
|
+
strategies:
|
97
|
+
</p>
|
98
|
+
|
99
|
+
<ul class="simple">
|
100
|
+
<li><strong>dom</strong>, for locators starting with "document."</li>
|
101
|
+
<li><strong>xpath</strong>, for locators starting with "//"</li>
|
102
|
+
<li><strong>identifier</strong>, otherwise</li>
|
103
|
+
</ul>
|
104
|
+
|
105
|
+
<h3><a name="element-filters">Element Filters</a></h3>
|
106
|
+
<blockquote>
|
107
|
+
<p>Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.</p>
|
108
|
+
<p>Filters look much like locators, ie.</p>
|
109
|
+
<blockquote>
|
110
|
+
<em>filterType</em><strong>=</strong><em>argument</em></blockquote>
|
111
|
+
|
112
|
+
<p>Supported element-filters are:</p>
|
113
|
+
<p><strong>value=</strong><em>valuePattern</em></p>
|
114
|
+
<blockquote>
|
115
|
+
Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.</blockquote>
|
116
|
+
<p><strong>index=</strong><em>index</em></p>
|
117
|
+
<blockquote>
|
118
|
+
Selects a single element based on its position in the list (offset from zero).</blockquote>
|
119
|
+
</blockquote>
|
120
|
+
|
121
|
+
<h3><a name="patterns"></a>String-match Patterns</h3>
|
122
|
+
|
123
|
+
<p>
|
124
|
+
Various Pattern syntaxes are available for matching string values:
|
125
|
+
</p>
|
126
|
+
<ul>
|
127
|
+
<li><strong>glob:</strong><em>pattern</em>:
|
128
|
+
Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
|
129
|
+
kind of limited regular-expression syntax typically used in command-line
|
130
|
+
shells. In a glob pattern, "*" represents any sequence of characters, and "?"
|
131
|
+
represents any single character. Glob patterns match against the entire
|
132
|
+
string.</li>
|
133
|
+
<li><strong>regexp:</strong><em>regexp</em>:
|
134
|
+
Match a string using a regular-expression. The full power of JavaScript
|
135
|
+
regular-expressions is available.</li>
|
136
|
+
<li><strong>regexpi:</strong><em>regexpi</em>:
|
137
|
+
Match a string using a case-insensitive regular-expression.</li>
|
138
|
+
<li><strong>exact:</strong><em>string</em>:
|
139
|
+
|
140
|
+
Match a string exactly, verbatim, without any of that fancy wildcard
|
141
|
+
stuff.</li>
|
142
|
+
</ul>
|
143
|
+
<p>
|
144
|
+
If no pattern prefix is specified, Selenium assumes that it's a "glob"
|
145
|
+
pattern.
|
146
|
+
</p>
|
147
|
+
<p>
|
148
|
+
For commands that return multiple values (such as verifySelectOptions),
|
149
|
+
the string being matched is a comma-separated list of the return values,
|
150
|
+
where both commas and backslashes in the values are backslash-escaped.
|
151
|
+
When providing a pattern, the optional matching syntax (i.e. glob,
|
152
|
+
regexp, etc.) is specified once, as usual, at the beginning of the
|
153
|
+
pattern.
|
154
|
+
</p></top>
|
155
|
+
|
156
|
+
<function name="click">
|
157
|
+
|
158
|
+
<param name="locator">an element locator</param>
|
159
|
+
|
160
|
+
<comment>Clicks on a link, button, checkbox or radio button. If the click action
|
161
|
+
causes a new page to load (like a link usually does), call
|
162
|
+
waitForPageToLoad.</comment>
|
163
|
+
|
164
|
+
</function>
|
165
|
+
|
166
|
+
<function name="doubleClick">
|
167
|
+
|
168
|
+
<param name="locator">an element locator</param>
|
169
|
+
|
170
|
+
<comment>Double clicks on a link, button, checkbox or radio button. If the double click action
|
171
|
+
causes a new page to load (like a link usually does), call
|
172
|
+
waitForPageToLoad.</comment>
|
173
|
+
|
174
|
+
</function>
|
175
|
+
|
176
|
+
<function name="contextMenu">
|
177
|
+
|
178
|
+
<param name="locator">an element locator</param>
|
179
|
+
|
180
|
+
<comment>Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).</comment>
|
181
|
+
|
182
|
+
</function>
|
183
|
+
|
184
|
+
<function name="clickAt">
|
185
|
+
|
186
|
+
<param name="locator">an element locator</param>
|
187
|
+
|
188
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
189
|
+
|
190
|
+
<comment>Clicks on a link, button, checkbox or radio button. If the click action
|
191
|
+
causes a new page to load (like a link usually does), call
|
192
|
+
waitForPageToLoad.</comment>
|
193
|
+
|
194
|
+
</function>
|
195
|
+
|
196
|
+
<function name="doubleClickAt">
|
197
|
+
|
198
|
+
<param name="locator">an element locator</param>
|
199
|
+
|
200
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
201
|
+
|
202
|
+
<comment>Doubleclicks on a link, button, checkbox or radio button. If the action
|
203
|
+
causes a new page to load (like a link usually does), call
|
204
|
+
waitForPageToLoad.</comment>
|
205
|
+
|
206
|
+
</function>
|
207
|
+
|
208
|
+
<function name="contextMenuAt">
|
209
|
+
|
210
|
+
<param name="locator">an element locator</param>
|
211
|
+
|
212
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
213
|
+
|
214
|
+
<comment>Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).</comment>
|
215
|
+
|
216
|
+
</function>
|
217
|
+
|
218
|
+
<function name="fireEvent">
|
219
|
+
|
220
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
221
|
+
|
222
|
+
<param name="eventName">the event name, e.g. "focus" or "blur"</param>
|
223
|
+
|
224
|
+
<comment>Explicitly simulate an event, to trigger the corresponding "on<em>event</em>"
|
225
|
+
handler.</comment>
|
226
|
+
|
227
|
+
</function>
|
228
|
+
|
229
|
+
<function name="focus">
|
230
|
+
|
231
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
232
|
+
|
233
|
+
<comment>Move the focus to the specified element; for example, if the element is an input field, move the cursor to that field.</comment>
|
234
|
+
|
235
|
+
</function>
|
236
|
+
|
237
|
+
<function name="keyPress">
|
238
|
+
|
239
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
240
|
+
|
241
|
+
<param name="keySequence">Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".</param>
|
242
|
+
|
243
|
+
<comment>Simulates a user pressing and releasing a key.</comment>
|
244
|
+
|
245
|
+
</function>
|
246
|
+
|
247
|
+
<function name="shiftKeyDown">
|
248
|
+
|
249
|
+
<comment>Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.</comment>
|
250
|
+
|
251
|
+
</function>
|
252
|
+
|
253
|
+
<function name="shiftKeyUp">
|
254
|
+
|
255
|
+
<comment>Release the shift key.</comment>
|
256
|
+
|
257
|
+
</function>
|
258
|
+
|
259
|
+
<function name="metaKeyDown">
|
260
|
+
|
261
|
+
<comment>Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.</comment>
|
262
|
+
|
263
|
+
</function>
|
264
|
+
|
265
|
+
<function name="metaKeyUp">
|
266
|
+
|
267
|
+
<comment>Release the meta key.</comment>
|
268
|
+
|
269
|
+
</function>
|
270
|
+
|
271
|
+
<function name="altKeyDown">
|
272
|
+
|
273
|
+
<comment>Press the alt key and hold it down until doAltUp() is called or a new page is loaded.</comment>
|
274
|
+
|
275
|
+
</function>
|
276
|
+
|
277
|
+
<function name="altKeyUp">
|
278
|
+
|
279
|
+
<comment>Release the alt key.</comment>
|
280
|
+
|
281
|
+
</function>
|
282
|
+
|
283
|
+
<function name="controlKeyDown">
|
284
|
+
|
285
|
+
<comment>Press the control key and hold it down until doControlUp() is called or a new page is loaded.</comment>
|
286
|
+
|
287
|
+
</function>
|
288
|
+
|
289
|
+
<function name="controlKeyUp">
|
290
|
+
|
291
|
+
<comment>Release the control key.</comment>
|
292
|
+
|
293
|
+
</function>
|
294
|
+
|
295
|
+
<function name="keyDown">
|
296
|
+
|
297
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
298
|
+
|
299
|
+
<param name="keySequence">Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".</param>
|
300
|
+
|
301
|
+
<comment>Simulates a user pressing a key (without releasing it yet).</comment>
|
302
|
+
|
303
|
+
</function>
|
304
|
+
|
305
|
+
<function name="keyUp">
|
306
|
+
|
307
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
308
|
+
|
309
|
+
<param name="keySequence">Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".</param>
|
310
|
+
|
311
|
+
<comment>Simulates a user releasing a key.</comment>
|
312
|
+
|
313
|
+
</function>
|
314
|
+
|
315
|
+
<function name="mouseOver">
|
316
|
+
|
317
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
318
|
+
|
319
|
+
<comment>Simulates a user hovering a mouse over the specified element.</comment>
|
320
|
+
|
321
|
+
</function>
|
322
|
+
|
323
|
+
<function name="mouseOut">
|
324
|
+
|
325
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
326
|
+
|
327
|
+
<comment>Simulates a user moving the mouse pointer away from the specified element.</comment>
|
328
|
+
|
329
|
+
</function>
|
330
|
+
|
331
|
+
<function name="mouseDown">
|
332
|
+
|
333
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
334
|
+
|
335
|
+
<comment>Simulates a user pressing the left mouse button (without releasing it yet) on
|
336
|
+
the specified element.</comment>
|
337
|
+
|
338
|
+
</function>
|
339
|
+
|
340
|
+
<function name="mouseDownRight">
|
341
|
+
|
342
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
343
|
+
|
344
|
+
<comment>Simulates a user pressing the right mouse button (without releasing it yet) on
|
345
|
+
the specified element.</comment>
|
346
|
+
|
347
|
+
</function>
|
348
|
+
|
349
|
+
<function name="mouseDownAt">
|
350
|
+
|
351
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
352
|
+
|
353
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
354
|
+
|
355
|
+
<comment>Simulates a user pressing the left mouse button (without releasing it yet) at
|
356
|
+
the specified location.</comment>
|
357
|
+
|
358
|
+
</function>
|
359
|
+
|
360
|
+
<function name="mouseDownRightAt">
|
361
|
+
|
362
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
363
|
+
|
364
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
365
|
+
|
366
|
+
<comment>Simulates a user pressing the right mouse button (without releasing it yet) at
|
367
|
+
the specified location.</comment>
|
368
|
+
|
369
|
+
</function>
|
370
|
+
|
371
|
+
<function name="mouseUp">
|
372
|
+
|
373
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
374
|
+
|
375
|
+
<comment>Simulates the event that occurs when the user releases the mouse button (i.e., stops
|
376
|
+
holding the button down) on the specified element.</comment>
|
377
|
+
|
378
|
+
</function>
|
379
|
+
|
380
|
+
<function name="mouseUpRight">
|
381
|
+
|
382
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
383
|
+
|
384
|
+
<comment>Simulates the event that occurs when the user releases the right mouse button (i.e., stops
|
385
|
+
holding the button down) on the specified element.</comment>
|
386
|
+
|
387
|
+
</function>
|
388
|
+
|
389
|
+
<function name="mouseUpAt">
|
390
|
+
|
391
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
392
|
+
|
393
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
394
|
+
|
395
|
+
<comment>Simulates the event that occurs when the user releases the mouse button (i.e., stops
|
396
|
+
holding the button down) at the specified location.</comment>
|
397
|
+
|
398
|
+
</function>
|
399
|
+
|
400
|
+
<function name="mouseUpRightAt">
|
401
|
+
|
402
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
403
|
+
|
404
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
405
|
+
|
406
|
+
<comment>Simulates the event that occurs when the user releases the right mouse button (i.e., stops
|
407
|
+
holding the button down) at the specified location.</comment>
|
408
|
+
|
409
|
+
</function>
|
410
|
+
|
411
|
+
<function name="mouseMove">
|
412
|
+
|
413
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
414
|
+
|
415
|
+
<comment>Simulates a user pressing the mouse button (without releasing it yet) on
|
416
|
+
the specified element.</comment>
|
417
|
+
|
418
|
+
</function>
|
419
|
+
|
420
|
+
<function name="mouseMoveAt">
|
421
|
+
|
422
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
423
|
+
|
424
|
+
<param name="coordString">specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.</param>
|
425
|
+
|
426
|
+
<comment>Simulates a user pressing the mouse button (without releasing it yet) on
|
427
|
+
the specified element.</comment>
|
428
|
+
|
429
|
+
</function>
|
430
|
+
|
431
|
+
<function name="type">
|
432
|
+
|
433
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
434
|
+
|
435
|
+
<param name="value">the value to type</param>
|
436
|
+
|
437
|
+
<comment>Sets the value of an input field, as though you typed it in.
|
438
|
+
|
439
|
+
<p>Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
|
440
|
+
value should be the value of the option selected, not the visible text.</p></comment>
|
441
|
+
|
442
|
+
</function>
|
443
|
+
|
444
|
+
<function name="typeKeys">
|
445
|
+
|
446
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
447
|
+
|
448
|
+
<param name="value">the value to type</param>
|
449
|
+
|
450
|
+
<comment>Simulates keystroke events on the specified element, as though you typed the value key-by-key.
|
451
|
+
|
452
|
+
<p>This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
|
453
|
+
this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.</p>
|
454
|
+
|
455
|
+
<p>Unlike the simple "type" command, which forces the specified value into the page directly, this command
|
456
|
+
may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
|
457
|
+
For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
|
458
|
+
the field.</p>
|
459
|
+
<p>In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
|
460
|
+
send the keystroke events corresponding to what you just typed.</p></comment>
|
461
|
+
|
462
|
+
</function>
|
463
|
+
|
464
|
+
<function name="setSpeed">
|
465
|
+
|
466
|
+
<param name="value">the number of milliseconds to pause after operation</param>
|
467
|
+
|
468
|
+
<comment>Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e.,
|
469
|
+
the delay is 0 milliseconds.</comment>
|
470
|
+
|
471
|
+
</function>
|
472
|
+
|
473
|
+
<function name="getSpeed">
|
474
|
+
|
475
|
+
<return type="string">the execution speed in milliseconds.</return>
|
476
|
+
|
477
|
+
<comment>Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e.,
|
478
|
+
the delay is 0 milliseconds.
|
479
|
+
|
480
|
+
See also setSpeed.</comment>
|
481
|
+
|
482
|
+
</function>
|
483
|
+
|
484
|
+
<function name="check">
|
485
|
+
|
486
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
487
|
+
|
488
|
+
<comment>Check a toggle-button (checkbox/radio)</comment>
|
489
|
+
|
490
|
+
</function>
|
491
|
+
|
492
|
+
<function name="uncheck">
|
493
|
+
|
494
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
495
|
+
|
496
|
+
<comment>Uncheck a toggle-button (checkbox/radio)</comment>
|
497
|
+
|
498
|
+
</function>
|
499
|
+
|
500
|
+
<function name="select">
|
501
|
+
|
502
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
503
|
+
|
504
|
+
<param name="optionLocator">an option locator (a label by default)</param>
|
505
|
+
|
506
|
+
<comment>Select an option from a drop-down using an option locator.
|
507
|
+
|
508
|
+
<p>
|
509
|
+
Option locators provide different ways of specifying options of an HTML
|
510
|
+
Select element (e.g. for selecting a specific option, or for asserting
|
511
|
+
that the selected option satisfies a specification). There are several
|
512
|
+
forms of Select Option Locator.
|
513
|
+
</p>
|
514
|
+
<ul>
|
515
|
+
<li><strong>label</strong>=<em>labelPattern</em>:
|
516
|
+
matches options based on their labels, i.e. the visible text. (This
|
517
|
+
is the default.)
|
518
|
+
<ul class="first last simple">
|
519
|
+
<li>label=regexp:^[Oo]ther</li>
|
520
|
+
</ul>
|
521
|
+
</li>
|
522
|
+
<li><strong>value</strong>=<em>valuePattern</em>:
|
523
|
+
matches options based on their values.
|
524
|
+
<ul class="first last simple">
|
525
|
+
<li>value=other</li>
|
526
|
+
</ul>
|
527
|
+
|
528
|
+
|
529
|
+
</li>
|
530
|
+
<li><strong>id</strong>=<em>id</em>:
|
531
|
+
|
532
|
+
matches options based on their ids.
|
533
|
+
<ul class="first last simple">
|
534
|
+
<li>id=option1</li>
|
535
|
+
</ul>
|
536
|
+
</li>
|
537
|
+
<li><strong>index</strong>=<em>index</em>:
|
538
|
+
matches an option based on its index (offset from zero).
|
539
|
+
<ul class="first last simple">
|
540
|
+
|
541
|
+
<li>index=2</li>
|
542
|
+
</ul>
|
543
|
+
</li>
|
544
|
+
</ul>
|
545
|
+
<p>
|
546
|
+
If no option locator prefix is provided, the default behaviour is to match on <strong>label</strong>.
|
547
|
+
</p></comment>
|
548
|
+
|
549
|
+
</function>
|
550
|
+
|
551
|
+
<function name="addSelection">
|
552
|
+
|
553
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a multi-select box</param>
|
554
|
+
|
555
|
+
<param name="optionLocator">an option locator (a label by default)</param>
|
556
|
+
|
557
|
+
<comment>Add a selection to the set of selected options in a multi-select element using an option locator.
|
558
|
+
|
559
|
+
@see #doSelect for details of option locators</comment>
|
560
|
+
|
561
|
+
</function>
|
562
|
+
|
563
|
+
<function name="removeSelection">
|
564
|
+
|
565
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a multi-select box</param>
|
566
|
+
|
567
|
+
<param name="optionLocator">an option locator (a label by default)</param>
|
568
|
+
|
569
|
+
<comment>Remove a selection from the set of selected options in a multi-select element using an option locator.
|
570
|
+
|
571
|
+
@see #doSelect for details of option locators</comment>
|
572
|
+
|
573
|
+
</function>
|
574
|
+
|
575
|
+
<function name="removeAllSelections">
|
576
|
+
|
577
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a multi-select box</param>
|
578
|
+
|
579
|
+
<comment>Unselects all of the selected options in a multi-select element.</comment>
|
580
|
+
|
581
|
+
</function>
|
582
|
+
|
583
|
+
<function name="submit">
|
584
|
+
|
585
|
+
<param name="formLocator">an <a href="#locators">element locator</a> for the form you want to submit</param>
|
586
|
+
|
587
|
+
<comment>Submit the specified form. This is particularly useful for forms without
|
588
|
+
submit buttons, e.g. single-input "Search" forms.</comment>
|
589
|
+
|
590
|
+
</function>
|
591
|
+
|
592
|
+
<function name="open">
|
593
|
+
|
594
|
+
<param name="url">the URL to open; may be relative or absolute</param>
|
595
|
+
|
596
|
+
<comment>Opens an URL in the test frame. This accepts both relative and absolute
|
597
|
+
URLs.
|
598
|
+
|
599
|
+
The "open" command waits for the page to load before proceeding,
|
600
|
+
ie. the "AndWait" suffix is implicit.
|
601
|
+
|
602
|
+
<em>Note</em>: The URL must be on the same domain as the runner HTML
|
603
|
+
due to security restrictions in the browser (Same Origin Policy). If you
|
604
|
+
need to open an URL on another domain, use the Selenium Server to start a
|
605
|
+
new browser session on that domain.</comment>
|
606
|
+
|
607
|
+
</function>
|
608
|
+
|
609
|
+
<function name="openWindow">
|
610
|
+
|
611
|
+
<param name="url">the URL to open, which can be blank</param>
|
612
|
+
|
613
|
+
<param name="windowID">the JavaScript window ID of the window to select</param>
|
614
|
+
|
615
|
+
<comment>Opens a popup window (if a window with that ID isn't already open).
|
616
|
+
After opening the window, you'll need to select it using the selectWindow
|
617
|
+
command.
|
618
|
+
|
619
|
+
<p>This command can also be a useful workaround for bug SEL-339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
|
620
|
+
In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
|
621
|
+
an empty (blank) url, like this: openWindow("", "myFunnyWindow").</p></comment>
|
622
|
+
|
623
|
+
</function>
|
624
|
+
|
625
|
+
<function name="selectWindow">
|
626
|
+
|
627
|
+
<param name="windowID">the JavaScript window ID of the window to select</param>
|
628
|
+
|
629
|
+
<comment>Selects a popup window using a window locator; once a popup window has been selected, all
|
630
|
+
commands go to that window. To select the main window again, use null
|
631
|
+
as the target.
|
632
|
+
|
633
|
+
<p>
|
634
|
+
|
635
|
+
Window locators provide different ways of specifying the window object:
|
636
|
+
by title, by internal JavaScript "name," or by JavaScript variable.
|
637
|
+
</p>
|
638
|
+
<ul>
|
639
|
+
<li><strong>title</strong>=<em>My Special Window</em>:
|
640
|
+
Finds the window using the text that appears in the title bar. Be careful;
|
641
|
+
two windows can share the same title. If that happens, this locator will
|
642
|
+
just pick one.
|
643
|
+
</li>
|
644
|
+
<li><strong>name</strong>=<em>myWindow</em>:
|
645
|
+
Finds the window using its internal JavaScript "name" property. This is the second
|
646
|
+
parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
|
647
|
+
(which Selenium intercepts).
|
648
|
+
</li>
|
649
|
+
<li><strong>var</strong>=<em>variableName</em>:
|
650
|
+
Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current
|
651
|
+
application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using
|
652
|
+
"var=foo".
|
653
|
+
</li>
|
654
|
+
</ul>
|
655
|
+
<p>
|
656
|
+
If no window locator prefix is provided, we'll try to guess what you mean like this:</p>
|
657
|
+
<p>1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).</p>
|
658
|
+
<p>2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
|
659
|
+
that this variable contains the return value from a call to the JavaScript window.open() method.</p>
|
660
|
+
<p>3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".</p>
|
661
|
+
<p>4.) If <em>that</em> fails, we'll try looping over all of the known windows to try to find the appropriate "title".
|
662
|
+
Since "title" is not necessarily unique, this may have unexpected behavior.</p>
|
663
|
+
|
664
|
+
<p>If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages
|
665
|
+
which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages
|
666
|
+
like the following for each window as it is opened:</p>
|
667
|
+
|
668
|
+
<p><code>debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"</code></p>
|
669
|
+
|
670
|
+
<p>In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
|
671
|
+
(This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
|
672
|
+
an empty (blank) url, like this: openWindow("", "myFunnyWindow").</p></comment>
|
673
|
+
|
674
|
+
</function>
|
675
|
+
|
676
|
+
<function name="selectPopUp">
|
677
|
+
|
678
|
+
<param name="windowID">an identifier for the popup window, which can take on a number of different meanings</param>
|
679
|
+
|
680
|
+
<comment>Simplifies the process of selecting a popup window (and does not offer
|
681
|
+
functionality beyond what <code>selectWindow()</code> already provides).
|
682
|
+
<ul>
|
683
|
+
<li>If <code>windowID</code> is either not specified, or specified as
|
684
|
+
"null", the first non-top window is selected. The top window is the one
|
685
|
+
that would be selected by <code>selectWindow()</code> without providing a
|
686
|
+
<code>windowID</code> . This should not be used when more than one popup
|
687
|
+
window is in play.</li>
|
688
|
+
<li>Otherwise, the window will be looked up considering
|
689
|
+
<code>windowID</code> as the following in order: 1) the "name" of the
|
690
|
+
window, as specified to <code>window.open()</code>; 2) a javascript
|
691
|
+
variable which is a reference to a window; and 3) the title of the
|
692
|
+
window. This is the same ordered lookup performed by
|
693
|
+
<code>selectWindow</code> .</li>
|
694
|
+
</ul></comment>
|
695
|
+
|
696
|
+
</function>
|
697
|
+
|
698
|
+
<function name="deselectPopUp">
|
699
|
+
|
700
|
+
<comment>Selects the main window. Functionally equivalent to using
|
701
|
+
<code>selectWindow()</code> and specifying no value for
|
702
|
+
<code>windowID</code>.</comment>
|
703
|
+
|
704
|
+
</function>
|
705
|
+
|
706
|
+
<function name="selectFrame">
|
707
|
+
|
708
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a frame or iframe</param>
|
709
|
+
|
710
|
+
<comment>Selects a frame within the current window. (You may invoke this command
|
711
|
+
multiple times to select nested frames.) To select the parent frame, use
|
712
|
+
"relative=parent" as a locator; to select the top frame, use "relative=top".
|
713
|
+
You can also select a frame by its 0-based index number; select the first frame with
|
714
|
+
"index=0", or the third frame with "index=2".
|
715
|
+
|
716
|
+
<p>You may also use a DOM expression to identify the frame you want directly,
|
717
|
+
like this: <code>dom=frames["main"].frames["subframe"]</code></p></comment>
|
718
|
+
|
719
|
+
</function>
|
720
|
+
|
721
|
+
<function name="getWhetherThisFrameMatchFrameExpression">
|
722
|
+
|
723
|
+
<return type="boolean">true if the new frame is this code's window</return>
|
724
|
+
|
725
|
+
<param name="currentFrameString">starting frame</param>
|
726
|
+
|
727
|
+
<param name="target">new frame (which might be relative to the current one)</param>
|
728
|
+
|
729
|
+
<comment>Determine whether current/locator identify the frame containing this running code.
|
730
|
+
|
731
|
+
<p>This is useful in proxy injection mode, where this code runs in every
|
732
|
+
browser frame and window, and sometimes the selenium server needs to identify
|
733
|
+
the "current" frame. In this case, when the test calls selectFrame, this
|
734
|
+
routine is called for each frame to figure out which one has been selected.
|
735
|
+
The selected frame will return true, while all others will return false.</p></comment>
|
736
|
+
|
737
|
+
</function>
|
738
|
+
|
739
|
+
<function name="getWhetherThisWindowMatchWindowExpression">
|
740
|
+
|
741
|
+
<return type="boolean">true if the new window is this code's window</return>
|
742
|
+
|
743
|
+
<param name="currentWindowString">starting window</param>
|
744
|
+
|
745
|
+
<param name="target">new window (which might be relative to the current one, e.g., "_parent")</param>
|
746
|
+
|
747
|
+
<comment>Determine whether currentWindowString plus target identify the window containing this running code.
|
748
|
+
|
749
|
+
<p>This is useful in proxy injection mode, where this code runs in every
|
750
|
+
browser frame and window, and sometimes the selenium server needs to identify
|
751
|
+
the "current" window. In this case, when the test calls selectWindow, this
|
752
|
+
routine is called for each window to figure out which one has been selected.
|
753
|
+
The selected window will return true, while all others will return false.</p></comment>
|
754
|
+
|
755
|
+
</function>
|
756
|
+
|
757
|
+
<function name="waitForPopUp">
|
758
|
+
|
759
|
+
<param name="windowID">the JavaScript window "name" of the window that will appear (not the text of the title bar) If unspecified, or specified as "null", this command will wait for the first non-top window to appear (don't rely on this if you are working with multiple popups simultaneously).</param>
|
760
|
+
|
761
|
+
<param name="timeout">a timeout in milliseconds, after which the action will return with an error. If this value is not specified, the default Selenium timeout will be used. See the setTimeout() command.</param>
|
762
|
+
|
763
|
+
<comment>Waits for a popup window to appear and load up.</comment>
|
764
|
+
|
765
|
+
</function>
|
766
|
+
|
767
|
+
<function name="chooseCancelOnNextConfirmation">
|
768
|
+
|
769
|
+
<comment><p>
|
770
|
+
By default, Selenium's overridden window.confirm() function will
|
771
|
+
return true, as if the user had manually clicked OK; after running
|
772
|
+
this command, the next call to confirm() will return false, as if
|
773
|
+
the user had clicked Cancel. Selenium will then resume using the
|
774
|
+
default behavior for future confirmations, automatically returning
|
775
|
+
true (OK) unless/until you explicitly call this command for each
|
776
|
+
confirmation.
|
777
|
+
</p>
|
778
|
+
<p>
|
779
|
+
Take note - every time a confirmation comes up, you must
|
780
|
+
consume it with a corresponding getConfirmation, or else
|
781
|
+
the next selenium operation will fail.
|
782
|
+
</p></comment>
|
783
|
+
|
784
|
+
</function>
|
785
|
+
|
786
|
+
<function name="chooseOkOnNextConfirmation">
|
787
|
+
|
788
|
+
<comment><p>
|
789
|
+
Undo the effect of calling chooseCancelOnNextConfirmation. Note
|
790
|
+
that Selenium's overridden window.confirm() function will normally automatically
|
791
|
+
return true, as if the user had manually clicked OK, so you shouldn't
|
792
|
+
need to use this command unless for some reason you need to change
|
793
|
+
your mind prior to the next confirmation. After any confirmation, Selenium will resume using the
|
794
|
+
default behavior for future confirmations, automatically returning
|
795
|
+
true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
|
796
|
+
confirmation.
|
797
|
+
</p>
|
798
|
+
<p>
|
799
|
+
Take note - every time a confirmation comes up, you must
|
800
|
+
consume it with a corresponding getConfirmation, or else
|
801
|
+
the next selenium operation will fail.
|
802
|
+
</p></comment>
|
803
|
+
|
804
|
+
</function>
|
805
|
+
|
806
|
+
<function name="answerOnNextPrompt">
|
807
|
+
|
808
|
+
<param name="answer">the answer to give in response to the prompt pop-up</param>
|
809
|
+
|
810
|
+
<comment>Instructs Selenium to return the specified answer string in response to
|
811
|
+
the next JavaScript prompt [window.prompt()].</comment>
|
812
|
+
|
813
|
+
</function>
|
814
|
+
|
815
|
+
<function name="goBack">
|
816
|
+
|
817
|
+
<comment>Simulates the user clicking the "back" button on their browser.</comment>
|
818
|
+
|
819
|
+
</function>
|
820
|
+
|
821
|
+
<function name="refresh">
|
822
|
+
|
823
|
+
<comment>Simulates the user clicking the "Refresh" button on their browser.</comment>
|
824
|
+
|
825
|
+
</function>
|
826
|
+
|
827
|
+
<function name="close">
|
828
|
+
|
829
|
+
<comment>Simulates the user clicking the "close" button in the titlebar of a popup
|
830
|
+
window or tab.</comment>
|
831
|
+
|
832
|
+
</function>
|
833
|
+
|
834
|
+
<function name="isAlertPresent">
|
835
|
+
|
836
|
+
<return type="boolean">true if there is an alert</return>
|
837
|
+
|
838
|
+
<comment>Has an alert occurred?
|
839
|
+
|
840
|
+
<p>
|
841
|
+
This function never throws an exception
|
842
|
+
</p></comment>
|
843
|
+
|
844
|
+
</function>
|
845
|
+
|
846
|
+
<function name="isPromptPresent">
|
847
|
+
|
848
|
+
<return type="boolean">true if there is a pending prompt</return>
|
849
|
+
|
850
|
+
<comment>Has a prompt occurred?
|
851
|
+
|
852
|
+
<p>
|
853
|
+
This function never throws an exception
|
854
|
+
</p></comment>
|
855
|
+
|
856
|
+
</function>
|
857
|
+
|
858
|
+
<function name="isConfirmationPresent">
|
859
|
+
|
860
|
+
<return type="boolean">true if there is a pending confirmation</return>
|
861
|
+
|
862
|
+
<comment>Has confirm() been called?
|
863
|
+
|
864
|
+
<p>
|
865
|
+
This function never throws an exception
|
866
|
+
</p></comment>
|
867
|
+
|
868
|
+
</function>
|
869
|
+
|
870
|
+
<function name="getAlert">
|
871
|
+
|
872
|
+
<return type="string">The message of the most recent JavaScript alert</return>
|
873
|
+
|
874
|
+
<comment>Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
|
875
|
+
|
876
|
+
<p>Getting an alert has the same effect as manually clicking OK. If an
|
877
|
+
alert is generated but you do not consume it with getAlert, the next Selenium action
|
878
|
+
will fail.</p>
|
879
|
+
|
880
|
+
<p>Under Selenium, JavaScript alerts will NOT pop up a visible alert
|
881
|
+
dialog.</p>
|
882
|
+
|
883
|
+
<p>Selenium does NOT support JavaScript alerts that are generated in a
|
884
|
+
page's onload() event handler. In this case a visible dialog WILL be
|
885
|
+
generated and Selenium will hang until someone manually clicks OK.</p></comment>
|
886
|
+
|
887
|
+
</function>
|
888
|
+
|
889
|
+
<function name="getConfirmation">
|
890
|
+
|
891
|
+
<return type="string">the message of the most recent JavaScript confirmation dialog</return>
|
892
|
+
|
893
|
+
<comment>Retrieves the message of a JavaScript confirmation dialog generated during
|
894
|
+
the previous action.
|
895
|
+
|
896
|
+
<p>
|
897
|
+
By default, the confirm function will return true, having the same effect
|
898
|
+
as manually clicking OK. This can be changed by prior execution of the
|
899
|
+
chooseCancelOnNextConfirmation command.
|
900
|
+
</p>
|
901
|
+
<p>
|
902
|
+
If an confirmation is generated but you do not consume it with getConfirmation,
|
903
|
+
the next Selenium action will fail.
|
904
|
+
</p>
|
905
|
+
|
906
|
+
<p>
|
907
|
+
NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
|
908
|
+
dialog.
|
909
|
+
</p>
|
910
|
+
|
911
|
+
<p>
|
912
|
+
NOTE: Selenium does NOT support JavaScript confirmations that are
|
913
|
+
generated in a page's onload() event handler. In this case a visible
|
914
|
+
dialog WILL be generated and Selenium will hang until you manually click
|
915
|
+
OK.
|
916
|
+
</p></comment>
|
917
|
+
|
918
|
+
</function>
|
919
|
+
|
920
|
+
<function name="getPrompt">
|
921
|
+
|
922
|
+
<return type="string">the message of the most recent JavaScript question prompt</return>
|
923
|
+
|
924
|
+
<comment>Retrieves the message of a JavaScript question prompt dialog generated during
|
925
|
+
the previous action.
|
926
|
+
|
927
|
+
<p>Successful handling of the prompt requires prior execution of the
|
928
|
+
answerOnNextPrompt command. If a prompt is generated but you
|
929
|
+
do not get/verify it, the next Selenium action will fail.</p>
|
930
|
+
|
931
|
+
<p>NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
|
932
|
+
dialog.</p>
|
933
|
+
|
934
|
+
<p>NOTE: Selenium does NOT support JavaScript prompts that are generated in a
|
935
|
+
page's onload() event handler. In this case a visible dialog WILL be
|
936
|
+
generated and Selenium will hang until someone manually clicks OK.</p></comment>
|
937
|
+
|
938
|
+
</function>
|
939
|
+
|
940
|
+
<function name="getLocation">
|
941
|
+
|
942
|
+
<return type="string">the absolute URL of the current page</return>
|
943
|
+
|
944
|
+
<comment>Gets the absolute URL of the current page.</comment>
|
945
|
+
|
946
|
+
</function>
|
947
|
+
|
948
|
+
<function name="getTitle">
|
949
|
+
|
950
|
+
<return type="string">the title of the current page</return>
|
951
|
+
|
952
|
+
<comment>Gets the title of the current page.</comment>
|
953
|
+
|
954
|
+
</function>
|
955
|
+
|
956
|
+
<function name="getBodyText">
|
957
|
+
|
958
|
+
<return type="string">the entire text of the page</return>
|
959
|
+
|
960
|
+
<comment>Gets the entire text of the page.</comment>
|
961
|
+
|
962
|
+
</function>
|
963
|
+
|
964
|
+
<function name="getValue">
|
965
|
+
|
966
|
+
<return type="string">the element value, or "on/off" for checkbox/radio elements</return>
|
967
|
+
|
968
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
969
|
+
|
970
|
+
<comment>Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
|
971
|
+
For checkbox/radio elements, the value will be "on" or "off" depending on
|
972
|
+
whether the element is checked or not.</comment>
|
973
|
+
|
974
|
+
</function>
|
975
|
+
|
976
|
+
<function name="getText">
|
977
|
+
|
978
|
+
<return type="string">the text of the element</return>
|
979
|
+
|
980
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
981
|
+
|
982
|
+
<comment>Gets the text of an element. This works for any element that contains
|
983
|
+
text. This command uses either the textContent (Mozilla-like browsers) or
|
984
|
+
the innerText (IE-like browsers) of the element, which is the rendered
|
985
|
+
text shown to the user.</comment>
|
986
|
+
|
987
|
+
</function>
|
988
|
+
|
989
|
+
<function name="highlight">
|
990
|
+
|
991
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
992
|
+
|
993
|
+
<comment>Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.</comment>
|
994
|
+
|
995
|
+
</function>
|
996
|
+
|
997
|
+
<function name="getEval">
|
998
|
+
|
999
|
+
<return type="string">the results of evaluating the snippet</return>
|
1000
|
+
|
1001
|
+
<param name="script">the JavaScript snippet to run</param>
|
1002
|
+
|
1003
|
+
<comment>Gets the result of evaluating the specified JavaScript snippet. The snippet may
|
1004
|
+
have multiple lines, but only the result of the last line will be returned.
|
1005
|
+
|
1006
|
+
<p>Note that, by default, the snippet will run in the context of the "selenium"
|
1007
|
+
object itself, so <code>this</code> will refer to the Selenium object. Use <code>window</code> to
|
1008
|
+
refer to the window of your application, e.g. <code>window.document.getElementById('foo')</code></p>
|
1009
|
+
|
1010
|
+
<p>If you need to use
|
1011
|
+
a locator to refer to a single element in your application page, you can
|
1012
|
+
use <code>this.browserbot.findElement("id=foo")</code> where "id=foo" is your locator.</p></comment>
|
1013
|
+
|
1014
|
+
</function>
|
1015
|
+
|
1016
|
+
<function name="isChecked">
|
1017
|
+
|
1018
|
+
<return type="boolean">true if the checkbox is checked, false otherwise</return>
|
1019
|
+
|
1020
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to a checkbox or radio button</param>
|
1021
|
+
|
1022
|
+
<comment>Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button.</comment>
|
1023
|
+
|
1024
|
+
</function>
|
1025
|
+
|
1026
|
+
<function name="getTable">
|
1027
|
+
|
1028
|
+
<return type="string">the text from the specified cell</return>
|
1029
|
+
|
1030
|
+
<param name="tableCellAddress">a cell address, e.g. "foo.1.4"</param>
|
1031
|
+
|
1032
|
+
<comment>Gets the text from a cell of a table. The cellAddress syntax
|
1033
|
+
tableLocator.row.column, where row and column start at 0.</comment>
|
1034
|
+
|
1035
|
+
</function>
|
1036
|
+
|
1037
|
+
<function name="getSelectedLabels">
|
1038
|
+
|
1039
|
+
<return type="string[]">an array of all selected option labels in the specified select drop-down</return>
|
1040
|
+
|
1041
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1042
|
+
|
1043
|
+
<comment>Gets all option labels (visible text) for selected options in the specified select or multi-select element.</comment>
|
1044
|
+
|
1045
|
+
</function>
|
1046
|
+
|
1047
|
+
<function name="getSelectedLabel">
|
1048
|
+
|
1049
|
+
<return type="string">the selected option label in the specified select drop-down</return>
|
1050
|
+
|
1051
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1052
|
+
|
1053
|
+
<comment>Gets option label (visible text) for selected option in the specified select element.</comment>
|
1054
|
+
|
1055
|
+
</function>
|
1056
|
+
|
1057
|
+
<function name="getSelectedValues">
|
1058
|
+
|
1059
|
+
<return type="string[]">an array of all selected option values in the specified select drop-down</return>
|
1060
|
+
|
1061
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1062
|
+
|
1063
|
+
<comment>Gets all option values (value attributes) for selected options in the specified select or multi-select element.</comment>
|
1064
|
+
|
1065
|
+
</function>
|
1066
|
+
|
1067
|
+
<function name="getSelectedValue">
|
1068
|
+
|
1069
|
+
<return type="string">the selected option value in the specified select drop-down</return>
|
1070
|
+
|
1071
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1072
|
+
|
1073
|
+
<comment>Gets option value (value attribute) for selected option in the specified select element.</comment>
|
1074
|
+
|
1075
|
+
</function>
|
1076
|
+
|
1077
|
+
<function name="getSelectedIndexes">
|
1078
|
+
|
1079
|
+
<return type="string[]">an array of all selected option indexes in the specified select drop-down</return>
|
1080
|
+
|
1081
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1082
|
+
|
1083
|
+
<comment>Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.</comment>
|
1084
|
+
|
1085
|
+
</function>
|
1086
|
+
|
1087
|
+
<function name="getSelectedIndex">
|
1088
|
+
|
1089
|
+
<return type="string">the selected option index in the specified select drop-down</return>
|
1090
|
+
|
1091
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1092
|
+
|
1093
|
+
<comment>Gets option index (option number, starting at 0) for selected option in the specified select element.</comment>
|
1094
|
+
|
1095
|
+
</function>
|
1096
|
+
|
1097
|
+
<function name="getSelectedIds">
|
1098
|
+
|
1099
|
+
<return type="string[]">an array of all selected option IDs in the specified select drop-down</return>
|
1100
|
+
|
1101
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1102
|
+
|
1103
|
+
<comment>Gets all option element IDs for selected options in the specified select or multi-select element.</comment>
|
1104
|
+
|
1105
|
+
</function>
|
1106
|
+
|
1107
|
+
<function name="getSelectedId">
|
1108
|
+
|
1109
|
+
<return type="string">the selected option ID in the specified select drop-down</return>
|
1110
|
+
|
1111
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1112
|
+
|
1113
|
+
<comment>Gets option element ID for selected option in the specified select element.</comment>
|
1114
|
+
|
1115
|
+
</function>
|
1116
|
+
|
1117
|
+
<function name="isSomethingSelected">
|
1118
|
+
|
1119
|
+
<return type="boolean">true if some option has been selected, false otherwise</return>
|
1120
|
+
|
1121
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1122
|
+
|
1123
|
+
<comment>Determines whether some option in a drop-down menu is selected.</comment>
|
1124
|
+
|
1125
|
+
</function>
|
1126
|
+
|
1127
|
+
<function name="getSelectOptions">
|
1128
|
+
|
1129
|
+
<return type="string[]">an array of all option labels in the specified select drop-down</return>
|
1130
|
+
|
1131
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1132
|
+
|
1133
|
+
<comment>Gets all option labels in the specified select drop-down.</comment>
|
1134
|
+
|
1135
|
+
</function>
|
1136
|
+
|
1137
|
+
<function name="getAttribute">
|
1138
|
+
|
1139
|
+
<return type="string">the value of the specified attribute</return>
|
1140
|
+
|
1141
|
+
<param name="attributeLocator">an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"</param>
|
1142
|
+
|
1143
|
+
<comment>Gets the value of an element attribute. The value of the attribute may
|
1144
|
+
differ across browsers (this is the case for the "style" attribute, for
|
1145
|
+
example).</comment>
|
1146
|
+
|
1147
|
+
</function>
|
1148
|
+
|
1149
|
+
<function name="isTextPresent">
|
1150
|
+
|
1151
|
+
<return type="boolean">true if the pattern matches the text, false otherwise</return>
|
1152
|
+
|
1153
|
+
<param name="pattern">a <a href="#patterns">pattern</a> to match with the text of the page</param>
|
1154
|
+
|
1155
|
+
<comment>Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.</comment>
|
1156
|
+
|
1157
|
+
</function>
|
1158
|
+
|
1159
|
+
<function name="isElementPresent">
|
1160
|
+
|
1161
|
+
<return type="boolean">true if the element is present, false otherwise</return>
|
1162
|
+
|
1163
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
1164
|
+
|
1165
|
+
<comment>Verifies that the specified element is somewhere on the page.</comment>
|
1166
|
+
|
1167
|
+
</function>
|
1168
|
+
|
1169
|
+
<function name="isVisible">
|
1170
|
+
|
1171
|
+
<return type="boolean">true if the specified element is visible, false otherwise</return>
|
1172
|
+
|
1173
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
1174
|
+
|
1175
|
+
<comment>Determines if the specified element is visible. An
|
1176
|
+
element can be rendered invisible by setting the CSS "visibility"
|
1177
|
+
property to "hidden", or the "display" property to "none", either for the
|
1178
|
+
element itself or one if its ancestors. This method will fail if
|
1179
|
+
the element is not present.</comment>
|
1180
|
+
|
1181
|
+
</function>
|
1182
|
+
|
1183
|
+
<function name="isEditable">
|
1184
|
+
|
1185
|
+
<return type="boolean">true if the input element is editable, false otherwise</return>
|
1186
|
+
|
1187
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
1188
|
+
|
1189
|
+
<comment>Determines whether the specified input element is editable, ie hasn't been disabled.
|
1190
|
+
This method will fail if the specified element isn't an input element.</comment>
|
1191
|
+
|
1192
|
+
</function>
|
1193
|
+
|
1194
|
+
<function name="getAllButtons">
|
1195
|
+
|
1196
|
+
<return type="string[]">the IDs of all buttons on the page</return>
|
1197
|
+
|
1198
|
+
<comment>Returns the IDs of all buttons on the page.
|
1199
|
+
|
1200
|
+
<p>If a given button has no ID, it will appear as "" in this array.</p></comment>
|
1201
|
+
|
1202
|
+
</function>
|
1203
|
+
|
1204
|
+
<function name="getAllLinks">
|
1205
|
+
|
1206
|
+
<return type="string[]">the IDs of all links on the page</return>
|
1207
|
+
|
1208
|
+
<comment>Returns the IDs of all links on the page.
|
1209
|
+
|
1210
|
+
<p>If a given link has no ID, it will appear as "" in this array.</p></comment>
|
1211
|
+
|
1212
|
+
</function>
|
1213
|
+
|
1214
|
+
<function name="getAllFields">
|
1215
|
+
|
1216
|
+
<return type="string[]">the IDs of all field on the page</return>
|
1217
|
+
|
1218
|
+
<comment>Returns the IDs of all input fields on the page.
|
1219
|
+
|
1220
|
+
<p>If a given field has no ID, it will appear as "" in this array.</p></comment>
|
1221
|
+
|
1222
|
+
</function>
|
1223
|
+
|
1224
|
+
<function name="getAttributeFromAllWindows">
|
1225
|
+
|
1226
|
+
<return type="string[]">the set of values of this attribute from all known windows.</return>
|
1227
|
+
|
1228
|
+
<param name="attributeName">name of an attribute on the windows</param>
|
1229
|
+
|
1230
|
+
<comment>Returns an array of JavaScript property values from all known windows having one.</comment>
|
1231
|
+
|
1232
|
+
</function>
|
1233
|
+
|
1234
|
+
<function name="dragdrop">
|
1235
|
+
|
1236
|
+
<param name="locator">an element locator</param>
|
1237
|
+
|
1238
|
+
<param name="movementsString">offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"</param>
|
1239
|
+
|
1240
|
+
<comment>deprecated - use dragAndDrop instead</comment>
|
1241
|
+
|
1242
|
+
</function>
|
1243
|
+
|
1244
|
+
<function name="setMouseSpeed">
|
1245
|
+
|
1246
|
+
<param name="pixels">the number of pixels between "mousemove" events</param>
|
1247
|
+
|
1248
|
+
<comment>Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
|
1249
|
+
<p>Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
|
1250
|
+
in between the start location and the end location; that can be very slow, and may
|
1251
|
+
cause some browsers to force the JavaScript to timeout.</p>
|
1252
|
+
|
1253
|
+
<p>If the mouse speed is greater than the distance between the two dragged objects, we'll
|
1254
|
+
just send one "mousemove" at the start location and then one final one at the end location.</p></comment>
|
1255
|
+
|
1256
|
+
</function>
|
1257
|
+
|
1258
|
+
<function name="getMouseSpeed">
|
1259
|
+
|
1260
|
+
<return type="number">the number of pixels between "mousemove" events during dragAndDrop commands (default=10)</return>
|
1261
|
+
|
1262
|
+
<comment>Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).</comment>
|
1263
|
+
|
1264
|
+
</function>
|
1265
|
+
|
1266
|
+
<function name="dragAndDrop">
|
1267
|
+
|
1268
|
+
<param name="locator">an element locator</param>
|
1269
|
+
|
1270
|
+
<param name="movementsString">offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"</param>
|
1271
|
+
|
1272
|
+
<comment>Drags an element a certain distance and then drops it</comment>
|
1273
|
+
|
1274
|
+
</function>
|
1275
|
+
|
1276
|
+
<function name="dragAndDropToObject">
|
1277
|
+
|
1278
|
+
<param name="locatorOfObjectToBeDragged">an element to be dragged</param>
|
1279
|
+
|
1280
|
+
<param name="locatorOfDragDestinationObject">an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped</param>
|
1281
|
+
|
1282
|
+
<comment>Drags an element and drops it on another element</comment>
|
1283
|
+
|
1284
|
+
</function>
|
1285
|
+
|
1286
|
+
<function name="windowFocus">
|
1287
|
+
|
1288
|
+
<comment>Gives focus to the currently selected window</comment>
|
1289
|
+
|
1290
|
+
</function>
|
1291
|
+
|
1292
|
+
<function name="windowMaximize">
|
1293
|
+
|
1294
|
+
<comment>Resize currently selected window to take up the entire screen</comment>
|
1295
|
+
|
1296
|
+
</function>
|
1297
|
+
|
1298
|
+
<function name="getAllWindowIds">
|
1299
|
+
|
1300
|
+
<return type="string[]">Array of identifiers of all windows that the browser knows about.</return>
|
1301
|
+
|
1302
|
+
<comment>Returns the IDs of all windows that the browser knows about in an array.</comment>
|
1303
|
+
|
1304
|
+
</function>
|
1305
|
+
|
1306
|
+
<function name="getAllWindowNames">
|
1307
|
+
|
1308
|
+
<return type="string[]">Array of names of all windows that the browser knows about.</return>
|
1309
|
+
|
1310
|
+
<comment>Returns the names of all windows that the browser knows about in an array.</comment>
|
1311
|
+
|
1312
|
+
</function>
|
1313
|
+
|
1314
|
+
<function name="getAllWindowTitles">
|
1315
|
+
|
1316
|
+
<return type="string[]">Array of titles of all windows that the browser knows about.</return>
|
1317
|
+
|
1318
|
+
<comment>Returns the titles of all windows that the browser knows about in an array.</comment>
|
1319
|
+
|
1320
|
+
</function>
|
1321
|
+
|
1322
|
+
<function name="getHtmlSource">
|
1323
|
+
|
1324
|
+
<return type="string">the entire HTML source</return>
|
1325
|
+
|
1326
|
+
<comment>Returns the entire HTML source between the opening and
|
1327
|
+
closing "html" tags.</comment>
|
1328
|
+
|
1329
|
+
</function>
|
1330
|
+
|
1331
|
+
<function name="setCursorPosition">
|
1332
|
+
|
1333
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an input element or textarea</param>
|
1334
|
+
|
1335
|
+
<param name="position">the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field. You can also set the cursor to -1 to move it to the end of the field.</param>
|
1336
|
+
|
1337
|
+
<comment>Moves the text cursor to the specified position in the given input element or textarea.
|
1338
|
+
This method will fail if the specified element isn't an input element or textarea.</comment>
|
1339
|
+
|
1340
|
+
</function>
|
1341
|
+
|
1342
|
+
<function name="getElementIndex">
|
1343
|
+
|
1344
|
+
<return type="number">of relative index of the element to its parent (starting from 0)</return>
|
1345
|
+
|
1346
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1347
|
+
|
1348
|
+
<comment>Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
|
1349
|
+
will be ignored.</comment>
|
1350
|
+
|
1351
|
+
</function>
|
1352
|
+
|
1353
|
+
<function name="isOrdered">
|
1354
|
+
|
1355
|
+
<return type="boolean">true if element1 is the previous sibling of element2, false otherwise</return>
|
1356
|
+
|
1357
|
+
<param name="locator1">an <a href="#locators">element locator</a> pointing to the first element</param>
|
1358
|
+
|
1359
|
+
<param name="locator2">an <a href="#locators">element locator</a> pointing to the second element</param>
|
1360
|
+
|
1361
|
+
<comment>Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
|
1362
|
+
not be considered ordered.</comment>
|
1363
|
+
|
1364
|
+
</function>
|
1365
|
+
|
1366
|
+
<function name="getElementPositionLeft">
|
1367
|
+
|
1368
|
+
<return type="number">of pixels from the edge of the frame.</return>
|
1369
|
+
|
1370
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element OR an element itself</param>
|
1371
|
+
|
1372
|
+
<comment>Retrieves the horizontal position of an element</comment>
|
1373
|
+
|
1374
|
+
</function>
|
1375
|
+
|
1376
|
+
<function name="getElementPositionTop">
|
1377
|
+
|
1378
|
+
<return type="number">of pixels from the edge of the frame.</return>
|
1379
|
+
|
1380
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element OR an element itself</param>
|
1381
|
+
|
1382
|
+
<comment>Retrieves the vertical position of an element</comment>
|
1383
|
+
|
1384
|
+
</function>
|
1385
|
+
|
1386
|
+
<function name="getElementWidth">
|
1387
|
+
|
1388
|
+
<return type="number">width of an element in pixels</return>
|
1389
|
+
|
1390
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1391
|
+
|
1392
|
+
<comment>Retrieves the width of an element</comment>
|
1393
|
+
|
1394
|
+
</function>
|
1395
|
+
|
1396
|
+
<function name="getElementHeight">
|
1397
|
+
|
1398
|
+
<return type="number">height of an element in pixels</return>
|
1399
|
+
|
1400
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1401
|
+
|
1402
|
+
<comment>Retrieves the height of an element</comment>
|
1403
|
+
|
1404
|
+
</function>
|
1405
|
+
|
1406
|
+
<function name="getCursorPosition">
|
1407
|
+
|
1408
|
+
<return type="number">the numerical position of the cursor in the field</return>
|
1409
|
+
|
1410
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an input element or textarea</param>
|
1411
|
+
|
1412
|
+
<comment>Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.
|
1413
|
+
|
1414
|
+
<p>Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
|
1415
|
+
return the position of the last location of the cursor, even though the cursor is now gone from the page. This is filed as <a href="http://jira.openqa.org/browse/SEL-243">SEL-243</a>.</p>
|
1416
|
+
This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.</comment>
|
1417
|
+
|
1418
|
+
</function>
|
1419
|
+
|
1420
|
+
<function name="getExpression">
|
1421
|
+
|
1422
|
+
<return type="string">the value passed in</return>
|
1423
|
+
|
1424
|
+
<param name="expression">the value to return</param>
|
1425
|
+
|
1426
|
+
<comment>Returns the specified expression.
|
1427
|
+
|
1428
|
+
<p>This is useful because of JavaScript preprocessing.
|
1429
|
+
It is used to generate commands like assertExpression and waitForExpression.</p></comment>
|
1430
|
+
|
1431
|
+
</function>
|
1432
|
+
|
1433
|
+
<function name="getXpathCount">
|
1434
|
+
|
1435
|
+
<return type="number">the number of nodes that match the specified xpath</return>
|
1436
|
+
|
1437
|
+
<param name="xpath">the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.</param>
|
1438
|
+
|
1439
|
+
<comment>Returns the number of nodes that match the specified xpath, eg. "//table" would give
|
1440
|
+
the number of tables.</comment>
|
1441
|
+
|
1442
|
+
</function>
|
1443
|
+
|
1444
|
+
<function name="assignId">
|
1445
|
+
|
1446
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1447
|
+
|
1448
|
+
<param name="identifier">a string to be used as the ID of the specified element</param>
|
1449
|
+
|
1450
|
+
<comment>Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
|
1451
|
+
using its ID rather than a slow/complicated XPath. This ID will disappear once the page is
|
1452
|
+
reloaded.</comment>
|
1453
|
+
|
1454
|
+
</function>
|
1455
|
+
|
1456
|
+
<function name="allowNativeXpath">
|
1457
|
+
|
1458
|
+
<param name="allow">boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath</param>
|
1459
|
+
|
1460
|
+
<comment>Specifies whether Selenium should use the native in-browser implementation
|
1461
|
+
of XPath (if any native version is available); if you pass "false" to
|
1462
|
+
this function, we will always use our pure-JavaScript xpath library.
|
1463
|
+
Using the pure-JS xpath library can improve the consistency of xpath
|
1464
|
+
element locators between different browser vendors, but the pure-JS
|
1465
|
+
version is much slower than the native implementations.</comment>
|
1466
|
+
|
1467
|
+
</function>
|
1468
|
+
|
1469
|
+
<function name="ignoreAttributesWithoutValue">
|
1470
|
+
|
1471
|
+
<param name="ignore">boolean, true means we'll ignore attributes without value at the expense of xpath "correctness"; false means we'll sacrifice speed for correctness.</param>
|
1472
|
+
|
1473
|
+
<comment>Specifies whether Selenium will ignore xpath attributes that have no
|
1474
|
+
value, i.e. are the empty string, when using the non-native xpath
|
1475
|
+
evaluation engine. You'd want to do this for performance reasons in IE.
|
1476
|
+
However, this could break certain xpaths, for example an xpath that looks
|
1477
|
+
for an attribute whose value is NOT the empty string.
|
1478
|
+
|
1479
|
+
The hope is that such xpaths are relatively rare, but the user should
|
1480
|
+
have the option of using them. Note that this only influences xpath
|
1481
|
+
evaluation when using the ajaxslt engine (i.e. not "javascript-xpath").</comment>
|
1482
|
+
|
1483
|
+
</function>
|
1484
|
+
|
1485
|
+
<function name="waitForCondition">
|
1486
|
+
|
1487
|
+
<param name="script">the JavaScript snippet to run</param>
|
1488
|
+
|
1489
|
+
<param name="timeout">a timeout in milliseconds, after which this command will return with an error</param>
|
1490
|
+
|
1491
|
+
<comment>Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
|
1492
|
+
The snippet may have multiple lines, but only the result of the last line
|
1493
|
+
will be considered.
|
1494
|
+
|
1495
|
+
<p>Note that, by default, the snippet will be run in the runner's test window, not in the window
|
1496
|
+
of your application. To get the window of your application, you can use
|
1497
|
+
the JavaScript snippet <code>selenium.browserbot.getCurrentWindow()</code>, and then
|
1498
|
+
run your JavaScript in there</p></comment>
|
1499
|
+
|
1500
|
+
</function>
|
1501
|
+
|
1502
|
+
<function name="setTimeout">
|
1503
|
+
|
1504
|
+
<param name="timeout">a timeout in milliseconds, after which the action will return with an error</param>
|
1505
|
+
|
1506
|
+
<comment>Specifies the amount of time that Selenium will wait for actions to complete.
|
1507
|
+
|
1508
|
+
<p>Actions that require waiting include "open" and the "waitFor*" actions.</p>
|
1509
|
+
The default timeout is 30 seconds.</comment>
|
1510
|
+
|
1511
|
+
</function>
|
1512
|
+
|
1513
|
+
<function name="waitForPageToLoad">
|
1514
|
+
|
1515
|
+
<param name="timeout">a timeout in milliseconds, after which this command will return with an error</param>
|
1516
|
+
|
1517
|
+
<comment>Waits for a new page to load.
|
1518
|
+
|
1519
|
+
<p>You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
|
1520
|
+
(which are only available in the JS API).</p>
|
1521
|
+
|
1522
|
+
<p>Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
|
1523
|
+
flag when it first notices a page load. Running any other Selenium command after
|
1524
|
+
turns the flag to false. Hence, if you want to wait for a page to load, you must
|
1525
|
+
wait immediately after a Selenium command that caused a page-load.</p></comment>
|
1526
|
+
|
1527
|
+
</function>
|
1528
|
+
|
1529
|
+
<function name="waitForFrameToLoad">
|
1530
|
+
|
1531
|
+
<param name="frameAddress">FrameAddress from the server side</param>
|
1532
|
+
|
1533
|
+
<param name="timeout">a timeout in milliseconds, after which this command will return with an error</param>
|
1534
|
+
|
1535
|
+
<comment>Waits for a new frame to load.
|
1536
|
+
|
1537
|
+
<p>Selenium constantly keeps track of new pages and frames loading,
|
1538
|
+
and sets a "newPageLoaded" flag when it first notices a page load.</p>
|
1539
|
+
|
1540
|
+
See waitForPageToLoad for more information.</comment>
|
1541
|
+
|
1542
|
+
</function>
|
1543
|
+
|
1544
|
+
<function name="getCookie">
|
1545
|
+
|
1546
|
+
<return type="string">all cookies of the current page under test</return>
|
1547
|
+
|
1548
|
+
<comment>Return all cookies of the current page under test.</comment>
|
1549
|
+
|
1550
|
+
</function>
|
1551
|
+
|
1552
|
+
<function name="getCookieByName">
|
1553
|
+
|
1554
|
+
<return type="string">the value of the cookie</return>
|
1555
|
+
|
1556
|
+
<param name="name">the name of the cookie</param>
|
1557
|
+
|
1558
|
+
<comment>Returns the value of the cookie with the specified name, or throws an error if the cookie is not present.</comment>
|
1559
|
+
|
1560
|
+
</function>
|
1561
|
+
|
1562
|
+
<function name="isCookiePresent">
|
1563
|
+
|
1564
|
+
<return type="boolean">true if a cookie with the specified name is present, or false otherwise.</return>
|
1565
|
+
|
1566
|
+
<param name="name">the name of the cookie</param>
|
1567
|
+
|
1568
|
+
<comment>Returns true if a cookie with the specified name is present, or false otherwise.</comment>
|
1569
|
+
|
1570
|
+
</function>
|
1571
|
+
|
1572
|
+
<function name="createCookie">
|
1573
|
+
|
1574
|
+
<param name="nameValuePair">name and value of the cookie in a format "name=value"</param>
|
1575
|
+
|
1576
|
+
<param name="optionsString">options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'. the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will usually fail.</param>
|
1577
|
+
|
1578
|
+
<comment>Create a new cookie whose path and domain are same with those of current page
|
1579
|
+
under test, unless you specified a path for this cookie explicitly.</comment>
|
1580
|
+
|
1581
|
+
</function>
|
1582
|
+
|
1583
|
+
<function name="deleteCookie">
|
1584
|
+
|
1585
|
+
<param name="name">the name of the cookie to be deleted</param>
|
1586
|
+
|
1587
|
+
<param name="optionsString">options for the cookie. Currently supported options include 'path', 'domain' and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true". The order of options are irrelevant. Note that specifying a domain that isn't a subset of the current domain will usually fail.</param>
|
1588
|
+
|
1589
|
+
<comment>Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you
|
1590
|
+
need to delete it using the exact same path and domain that were used to create the cookie.
|
1591
|
+
If the path is wrong, or the domain is wrong, the cookie simply won't be deleted. Also
|
1592
|
+
note that specifying a domain that isn't a subset of the current domain will usually fail.
|
1593
|
+
|
1594
|
+
Since there's no way to discover at runtime the original path and domain of a given cookie,
|
1595
|
+
we've added an option called 'recurse' to try all sub-domains of the current domain with
|
1596
|
+
all paths that are a subset of the current path. Beware; this option can be slow. In
|
1597
|
+
big-O notation, it operates in O(n*m) time, where n is the number of dots in the domain
|
1598
|
+
name and m is the number of slashes in the path.</comment>
|
1599
|
+
|
1600
|
+
</function>
|
1601
|
+
|
1602
|
+
<function name="deleteAllVisibleCookies">
|
1603
|
+
|
1604
|
+
<comment>Calls deleteCookie with recurse=true on all cookies visible to the current page.
|
1605
|
+
As noted on the documentation for deleteCookie, recurse=true can be much slower
|
1606
|
+
than simply deleting the cookies using a known domain/path.</comment>
|
1607
|
+
|
1608
|
+
</function>
|
1609
|
+
|
1610
|
+
<function name="setBrowserLogLevel">
|
1611
|
+
|
1612
|
+
<param name="logLevel">one of the following: "debug", "info", "warn", "error" or "off"</param>
|
1613
|
+
|
1614
|
+
<comment>Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
|
1615
|
+
Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
|
1616
|
+
To see the browser logs, you need to
|
1617
|
+
either show the log window in GUI mode, or enable browser-side logging in Selenium RC.</comment>
|
1618
|
+
|
1619
|
+
</function>
|
1620
|
+
|
1621
|
+
<function name="runScript">
|
1622
|
+
|
1623
|
+
<param name="script">the JavaScript snippet to run</param>
|
1624
|
+
|
1625
|
+
<comment>Creates a new "script" tag in the body of the current test window, and
|
1626
|
+
adds the specified text into the body of the command. Scripts run in
|
1627
|
+
this way can often be debugged more easily than scripts executed using
|
1628
|
+
Selenium's "getEval" command. Beware that JS exceptions thrown in these script
|
1629
|
+
tags aren't managed by Selenium, so you should probably wrap your script
|
1630
|
+
in try/catch blocks if there is any chance that the script will throw
|
1631
|
+
an exception.</comment>
|
1632
|
+
|
1633
|
+
</function>
|
1634
|
+
|
1635
|
+
<function name="addLocationStrategy">
|
1636
|
+
|
1637
|
+
<param name="strategyName">the name of the strategy to define; this should use only letters [a-zA-Z] with no spaces or other punctuation.</param>
|
1638
|
+
|
1639
|
+
<param name="functionDefinition">a string defining the body of a function in JavaScript. For example: <code>return inDocument.getElementById(locator);</code></param>
|
1640
|
+
|
1641
|
+
<comment>Defines a new function for Selenium to locate elements on the page.
|
1642
|
+
For example,
|
1643
|
+
if you define the strategy "foo", and someone runs click("foo=blah"), we'll
|
1644
|
+
run your function, passing you the string "blah", and click on the element
|
1645
|
+
that your function
|
1646
|
+
returns, or throw an "Element not found" error if your function returns null.
|
1647
|
+
|
1648
|
+
We'll pass three arguments to your function:
|
1649
|
+
<ul>
|
1650
|
+
<li>locator: the string the user passed in</li>
|
1651
|
+
<li>inWindow: the currently selected window</li>
|
1652
|
+
<li>inDocument: the currently selected document</li>
|
1653
|
+
</ul>
|
1654
|
+
The function must return null if the element can't be found.</comment>
|
1655
|
+
|
1656
|
+
</function>
|
1657
|
+
|
1658
|
+
<function name="captureEntirePageScreenshot">
|
1659
|
+
|
1660
|
+
<param name="filename">the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code.</param>
|
1661
|
+
|
1662
|
+
<param name="kwargs">a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options: <dl> <dt>background</dt> <dd>the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).</dd> </dl></param>
|
1663
|
+
|
1664
|
+
<comment>Saves the entire contents of the current window canvas to a PNG file.
|
1665
|
+
Contrast this with the captureScreenshot command, which captures the
|
1666
|
+
contents of the OS viewport (i.e. whatever is currently being displayed
|
1667
|
+
on the monitor), and is implemented in the RC only. Currently this only
|
1668
|
+
works in Firefox when running in chrome mode, and in IE non-HTA using
|
1669
|
+
the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly
|
1670
|
+
borrowed from the Screengrab! Firefox extension. Please see
|
1671
|
+
http://www.screengrab.org and http://snapsie.sourceforge.net/ for
|
1672
|
+
details.</comment>
|
1673
|
+
|
1674
|
+
</function>
|
1675
|
+
|
1676
|
+
<function name="rollup">
|
1677
|
+
|
1678
|
+
<param name="rollupName">the name of the rollup command</param>
|
1679
|
+
|
1680
|
+
<param name="kwargs">keyword arguments string that influences how the rollup expands into commands</param>
|
1681
|
+
|
1682
|
+
<comment>Executes a command rollup, which is a series of commands with a unique
|
1683
|
+
name, and optionally arguments that control the generation of the set of
|
1684
|
+
commands. If any one of the rolled-up commands fails, the rollup is
|
1685
|
+
considered to have failed. Rollups may also contain nested rollups.</comment>
|
1686
|
+
|
1687
|
+
</function>
|
1688
|
+
|
1689
|
+
<function name="addScript">
|
1690
|
+
|
1691
|
+
<param name="scriptContent">the Javascript content of the script to add</param>
|
1692
|
+
|
1693
|
+
<param name="scriptTagId">(optional) the id of the new script tag. If specified, and an element with this id already exists, this operation will fail.</param>
|
1694
|
+
|
1695
|
+
<comment>Loads script content into a new script tag in the Selenium document. This
|
1696
|
+
differs from the runScript command in that runScript adds the script tag
|
1697
|
+
to the document of the AUT, not the Selenium document. The following
|
1698
|
+
entities in the script content are replaced by the characters they
|
1699
|
+
represent:
|
1700
|
+
|
1701
|
+
<
|
1702
|
+
>
|
1703
|
+
&
|
1704
|
+
|
1705
|
+
The corresponding remove command is removeScript.</comment>
|
1706
|
+
|
1707
|
+
</function>
|
1708
|
+
|
1709
|
+
<function name="removeScript">
|
1710
|
+
|
1711
|
+
<param name="scriptTagId">the id of the script element to remove.</param>
|
1712
|
+
|
1713
|
+
<comment>Removes a script tag from the Selenium document identified by the given
|
1714
|
+
id. Does nothing if the referenced tag doesn't exist.</comment>
|
1715
|
+
|
1716
|
+
</function>
|
1717
|
+
|
1718
|
+
<function name="useXpathLibrary">
|
1719
|
+
|
1720
|
+
<param name="libraryName">name of the desired library Only the following three can be chosen: <ul> <li>"ajaxslt" - Google's library</li> <li>"javascript-xpath" - Cybozu Labs' faster library</li> <li>"default" - The default library. Currently the default library is "ajaxslt" .</li> </ul> If libraryName isn't one of these three, then no change will be made.</param>
|
1721
|
+
|
1722
|
+
<comment>Allows choice of one of the available libraries.</comment>
|
1723
|
+
|
1724
|
+
</function>
|
1725
|
+
|
1726
|
+
<function name="pause">
|
1727
|
+
|
1728
|
+
<param name="waitTime">the amount of time to sleep (in milliseconds)</param>
|
1729
|
+
|
1730
|
+
<comment>Wait for the specified amount of time (in milliseconds)</comment>
|
1731
|
+
|
1732
|
+
</function>
|
1733
|
+
|
1734
|
+
<function name="break">
|
1735
|
+
|
1736
|
+
<comment>Halt the currently running test, and wait for the user to press the Continue button.
|
1737
|
+
This command is useful for debugging, but be careful when using it, because it will
|
1738
|
+
force automated tests to hang until a user intervenes manually.</comment>
|
1739
|
+
|
1740
|
+
</function>
|
1741
|
+
|
1742
|
+
<function name="store">
|
1743
|
+
|
1744
|
+
<param name="expression">the value to store</param>
|
1745
|
+
|
1746
|
+
<param name="variableName">the name of a <a href="#storedVars">variable</a> in which the result is to be stored.</param>
|
1747
|
+
|
1748
|
+
<comment>This command is a synonym for storeExpression.</comment>
|
1749
|
+
|
1750
|
+
</function>
|
1751
|
+
|
1752
|
+
<function name="echo">
|
1753
|
+
|
1754
|
+
<param name="message">the message to print</param>
|
1755
|
+
|
1756
|
+
<comment>Prints the specified message into the third table cell in your Selenese tables.
|
1757
|
+
Useful for debugging.</comment>
|
1758
|
+
|
1759
|
+
</function>
|
1760
|
+
|
1761
|
+
<function name="assertSelected">
|
1762
|
+
|
1763
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1764
|
+
|
1765
|
+
<param name="optionLocator">an option locator, typically just an option label (e.g. "John Smith")</param>
|
1766
|
+
|
1767
|
+
<comment>Verifies that the selected option of a drop-down satisfies the optionSpecifier. <i>Note that this command is deprecated; you should use assertSelectedLabel, assertSelectedValue, assertSelectedIndex, or assertSelectedId instead.</i>
|
1768
|
+
|
1769
|
+
<p>See the select command for more information about option locators.</p></comment>
|
1770
|
+
|
1771
|
+
</function>
|
1772
|
+
|
1773
|
+
<function name="assertFailureOnNext">
|
1774
|
+
|
1775
|
+
<param name="message">The failure message we should expect. This command will fail if the wrong failure message appears.</param>
|
1776
|
+
|
1777
|
+
<comment>Tell Selenium to expect a failure on the next command execution.</comment>
|
1778
|
+
|
1779
|
+
</function>
|
1780
|
+
|
1781
|
+
<function name="assertErrorOnNext">
|
1782
|
+
|
1783
|
+
<param name="message">The error message we should expect. This command will fail if the wrong error message appears.</param>
|
1784
|
+
|
1785
|
+
<comment>Tell Selenium to expect an error on the next command execution.</comment>
|
1786
|
+
|
1787
|
+
</function>
|
1788
|
+
|
1789
|
+
</apidoc>
|