browsercms 3.1.4 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/cms/content_block_controller.rb +2 -2
- data/app/controllers/cms/section_nodes_controller.rb +6 -1
- data/app/controllers/cms/sections_controller.rb +1 -1
- data/app/helpers/cms/application_helper.rb +1 -1
- data/app/helpers/cms/content_block_helper.rb +27 -0
- data/app/helpers/cms/section_nodes_helper.rb +43 -5
- data/app/models/abstract_file_block.rb +16 -1
- data/app/models/attachment.rb +17 -35
- data/app/models/file_block.rb +0 -12
- data/app/models/image_block.rb +0 -12
- data/app/models/link.rb +4 -21
- data/app/models/page.rb +31 -34
- data/app/models/section.rb +82 -44
- data/app/models/section_node.rb +39 -24
- data/app/models/user.rb +5 -0
- data/app/views/cms/blocks/index.html.erb +4 -4
- data/app/views/cms/file_blocks/_form.html.erb +1 -1
- data/app/views/cms/image_blocks/_form.html.erb +1 -1
- data/app/views/cms/section_nodes/_link.html.erb +6 -3
- data/app/views/cms/section_nodes/_node.html.erb +11 -1
- data/app/views/cms/section_nodes/_page.html.erb +13 -7
- data/app/views/cms/section_nodes/_section.html.erb +24 -8
- data/app/views/cms/section_nodes/index.html.erb +28 -16
- data/app/views/layouts/templates/default.html.erb +17 -0
- data/browsercms.gemspec +28 -1413
- data/db/migrate/20120117144039_browsercms315.rb +94 -0
- data/db/migrate/{20081114172307_load_seed_data.rb → 20121114172307_load_seeds.rb} +8 -1
- data/lib/acts_as_list.rb +1 -1
- data/lib/browsercms.rb +2 -0
- data/lib/cms/addressable.rb +83 -0
- data/lib/cms/behaviors/attaching.rb +44 -24
- data/lib/cms/behaviors/connecting.rb +2 -1
- data/lib/cms/behaviors/publishing.rb +12 -3
- data/lib/cms/behaviors/versioning.rb +83 -53
- data/lib/cms/content_rendering_support.rb +3 -3
- data/lib/cms/error_pages.rb +8 -0
- data/lib/cms/init.rb +5 -3
- data/lib/cms/version.rb +1 -1
- data/templates/blank.rb +2 -0
- data/templates/demo.rb +2 -0
- data/templates/module.rb +2 -0
- data/test/custom_assertions.rb +7 -1
- data/test/factories.rb +3 -1
- data/test/factories/sitemap_factories.rb +28 -0
- data/test/fixtures/connectors.yml +97 -0
- data/test/fixtures/content_type_groups.yml +13 -0
- data/test/fixtures/content_types.yml +50 -0
- data/test/fixtures/dynamic_view_versions.yml +26 -0
- data/test/fixtures/dynamic_views.yml +26 -0
- data/test/fixtures/group_permissions.yml +16 -0
- data/test/fixtures/group_sections.yml +31 -0
- data/test/fixtures/group_type_permissions.yml +11 -0
- data/test/fixtures/group_types.yml +25 -0
- data/test/fixtures/groups.yml +25 -0
- data/test/fixtures/html_block_versions.yml +67 -0
- data/test/fixtures/html_blocks.yml +63 -0
- data/test/fixtures/page_versions.yml +265 -0
- data/test/fixtures/pages.yml +85 -0
- data/test/fixtures/permissions.yml +28 -0
- data/test/fixtures/section_nodes.yml +46 -0
- data/test/fixtures/sections.yml +19 -0
- data/test/fixtures/sites.yml +9 -0
- data/test/fixtures/user_group_memberships.yml +11 -0
- data/test/fixtures/users.yml +15 -0
- data/test/functional/cms/content_controller_test.rb +6 -1
- data/test/functional/cms/file_blocks_controller_test.rb +1 -0
- data/test/functional/cms/html_blocks_controller_test.rb +1 -0
- data/test/functional/cms/image_blocks_controller_test.rb +39 -32
- data/test/functional/cms/section_nodes_controller_test.rb +48 -20
- data/test/functional/cms/sections_controller_test.rb +3 -1
- data/test/functional/tests/pretend_controller_test.rb +6 -3
- data/test/integration/cms/ckeditor_test.rb +5 -2
- data/test/integration/sitemap_performance_test.rb +26 -0
- data/test/selenium-core/Blank.html +7 -0
- data/test/selenium-core/InjectedRemoteRunner.html +8 -0
- data/test/selenium-core/RemoteRunner.html +110 -0
- data/test/selenium-core/SeleniumLog.html +109 -0
- data/test/selenium-core/TestPrompt.html +145 -0
- data/test/selenium-core/TestRunner-splash.html +55 -0
- data/test/selenium-core/TestRunner.hta +176 -0
- data/test/selenium-core/TestRunner.html +176 -0
- data/test/selenium-core/domviewer/butmin.gif +0 -0
- data/test/selenium-core/domviewer/butplus.gif +0 -0
- data/test/selenium-core/domviewer/domviewer.css +298 -0
- data/test/selenium-core/domviewer/domviewer.html +16 -0
- data/test/selenium-core/domviewer/selenium-domviewer.js +205 -0
- data/test/selenium-core/icons/all.png +0 -0
- data/test/selenium-core/icons/continue.png +0 -0
- data/test/selenium-core/icons/continue_disabled.png +0 -0
- data/test/selenium-core/icons/pause.png +0 -0
- data/test/selenium-core/icons/pause_disabled.png +0 -0
- data/test/selenium-core/icons/selected.png +0 -0
- data/test/selenium-core/icons/step.png +0 -0
- data/test/selenium-core/icons/step_disabled.png +0 -0
- data/test/selenium-core/iedoc-core.xml +1515 -0
- data/test/selenium-core/iedoc.xml +1469 -0
- data/test/selenium-core/lib/cssQuery/cssQuery-p.js +6 -0
- data/test/selenium-core/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/test/selenium-core/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/test/selenium-core/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/test/selenium-core/lib/cssQuery/src/cssQuery.js +356 -0
- data/test/selenium-core/lib/prototype.js +2006 -0
- data/test/selenium-core/lib/scriptaculous/builder.js +101 -0
- data/test/selenium-core/lib/scriptaculous/controls.js +815 -0
- data/test/selenium-core/lib/scriptaculous/dragdrop.js +915 -0
- data/test/selenium-core/lib/scriptaculous/effects.js +958 -0
- data/test/selenium-core/lib/scriptaculous/scriptaculous.js +47 -0
- data/test/selenium-core/lib/scriptaculous/slider.js +283 -0
- data/test/selenium-core/lib/scriptaculous/unittest.js +383 -0
- data/test/selenium-core/scripts/find_matching_child.js +69 -0
- data/test/selenium-core/scripts/htmlutils.js +894 -0
- data/test/selenium-core/scripts/injection.html +72 -0
- data/test/selenium-core/scripts/js2html.js +70 -0
- data/test/selenium-core/scripts/narcissus-defs.js +175 -0
- data/test/selenium-core/scripts/narcissus-exec.js +1054 -0
- data/test/selenium-core/scripts/narcissus-parse.js +1003 -0
- data/test/selenium-core/scripts/se2html.js +63 -0
- data/test/selenium-core/scripts/selenium-api.js +2409 -0
- data/test/selenium-core/scripts/selenium-browserbot.js +2203 -0
- data/test/selenium-core/scripts/selenium-browserdetect.js +150 -0
- data/test/selenium-core/scripts/selenium-commandhandlers.js +377 -0
- data/test/selenium-core/scripts/selenium-executionloop.js +175 -0
- data/test/selenium-core/scripts/selenium-logging.js +147 -0
- data/test/selenium-core/scripts/selenium-remoterunner.js +571 -0
- data/test/selenium-core/scripts/selenium-testrunner.js +1333 -0
- data/test/selenium-core/scripts/selenium-version.js +5 -0
- data/test/selenium-core/scripts/user-extensions.js +3 -0
- data/test/selenium-core/scripts/user-extensions.js.sample +75 -0
- data/test/selenium-core/scripts/xmlextras.js +153 -0
- data/test/selenium-core/selenium-logo.png +0 -0
- data/test/selenium-core/selenium-test.css +43 -0
- data/test/selenium-core/selenium.css +299 -0
- data/test/selenium-core/xpath/dom.js +428 -0
- data/test/selenium-core/xpath/misc.js +252 -0
- data/test/selenium-core/xpath/xpath.js +2223 -0
- data/test/selenium/_login_as_cmsadmin.rsel +4 -0
- data/test/selenium/dashboard.rsel +5 -0
- data/test/selenium/html_blocks.rsel +4 -0
- data/test/selenium/login/failed_login.rsel +8 -0
- data/test/selenium/login/successful_login.rsel +9 -0
- data/test/selenium/page_templates.rsel +12 -0
- data/test/selenium/pages/edit_properties.rsel +5 -0
- data/test/selenium/site/view_home_page.rsel +4 -0
- data/test/selenium/sitemap/move_page.rsel +9 -0
- data/test/selenium/sitemap/open_section.rsel +6 -0
- data/test/selenium/sitemap/select_page.rsel +12 -0
- data/test/selenium/sitemap/select_section.rsel +17 -0
- data/test/test_helper.rb +30 -12
- data/test/unit/behaviors/attaching_test.rb +4 -6
- data/test/unit/behaviors/connectable_test.rb +29 -0
- data/test/unit/behaviors/publishable_test.rb +40 -9
- data/test/unit/behaviors/versioning_test.rb +36 -0
- data/test/unit/helpers/menu_helper_test.rb +5 -2
- data/test/unit/helpers/page_helper_test.rb +2 -0
- data/test/unit/lib/cms/sitemap_test.rb +206 -0
- data/test/unit/models/attachment_test.rb +51 -31
- data/test/unit/models/file_block_test.rb +74 -55
- data/test/unit/models/link_test.rb +44 -0
- data/test/unit/models/page_test.rb +290 -224
- data/test/unit/models/sections_test.rb +144 -44
- data/test/unit/models/user_test.rb +28 -18
- metadata +581 -350
- data/app/views/cms/section_nodes/_section_node.html.erb +0 -10
- data/test/unit/models/section_node_test.rb +0 -92
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>DOM Viewer</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
7
|
+
<link rel="stylesheet" type="text/css" href="domviewer.css"/>
|
8
|
+
<script type="text/javascript" src="selenium-domviewer.js"></script>
|
9
|
+
</head>
|
10
|
+
<body onload="loadDomViewer();">
|
11
|
+
<h3>DOM Viewer</h3>
|
12
|
+
<p> This page is generated using JavaScript. If you see this text, your
|
13
|
+
browser doesn't support JavaScript.</p>
|
14
|
+
</body>
|
15
|
+
|
16
|
+
</html>
|
@@ -0,0 +1,205 @@
|
|
1
|
+
var HIDDEN="hidden";
|
2
|
+
var LEVEL = "level";
|
3
|
+
var PLUS_SRC="butplus.gif";
|
4
|
+
var MIN_SRC="butmin.gif";
|
5
|
+
var newRoot;
|
6
|
+
var maxColumns=1;
|
7
|
+
|
8
|
+
function loadDomViewer() {
|
9
|
+
// See if the rootDocument variable has been set on this window.
|
10
|
+
var rootDocument = window.rootDocument;
|
11
|
+
|
12
|
+
// If not look to the opener for an explicity rootDocument variable, otherwise, use the opener document
|
13
|
+
if (!rootDocument && window.opener) {
|
14
|
+
rootDocument = window.opener.rootDocument || window.opener.document;
|
15
|
+
}
|
16
|
+
|
17
|
+
if (rootDocument) {
|
18
|
+
document.body.innerHTML = displayDOM(rootDocument);
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
document.body.innerHTML = "<b>Must specify rootDocument for window. This can be done by setting the rootDocument variable on this window, or on the opener window for a popup window.</b>";
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
function displayDOM(root){
|
27
|
+
var str = "";
|
28
|
+
str+="<table>";
|
29
|
+
str += treeTraversal(root,0);
|
30
|
+
// to make table columns work well.
|
31
|
+
str += "<tr>";
|
32
|
+
for (var i=0; i < maxColumns; i++) {
|
33
|
+
str+= "<td> </td>";
|
34
|
+
}
|
35
|
+
str += "</tr>";
|
36
|
+
str += "</table>";
|
37
|
+
return str;
|
38
|
+
}
|
39
|
+
|
40
|
+
function checkForChildren(element){
|
41
|
+
if(!element.hasChildNodes())
|
42
|
+
return false;
|
43
|
+
|
44
|
+
var nodes = element.childNodes;
|
45
|
+
var size = nodes.length;
|
46
|
+
var count=0;
|
47
|
+
|
48
|
+
for(var i=0; i< size; i++){
|
49
|
+
var node = nodes.item(i);
|
50
|
+
//if(node.toString()=="[object Text]"){
|
51
|
+
//this is equalent to the above
|
52
|
+
//but will work with more browsers
|
53
|
+
if(node.nodeType!=1){
|
54
|
+
count++;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
if(count == size)
|
59
|
+
return false;
|
60
|
+
else
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
|
64
|
+
function treeTraversal(root, level){
|
65
|
+
var str = "";
|
66
|
+
var nodes= null;
|
67
|
+
var size = null;
|
68
|
+
//it is supposed to show the last node,
|
69
|
+
//but the last node is always nodeText type
|
70
|
+
//and we don't show it
|
71
|
+
if(!root.hasChildNodes())
|
72
|
+
return "";//displayNode(root,level,false);
|
73
|
+
|
74
|
+
nodes = root.childNodes;
|
75
|
+
size = nodes.length;
|
76
|
+
|
77
|
+
for(var i=0; i< size; i++){
|
78
|
+
var element = nodes.item(i);
|
79
|
+
//if the node is textNode, don't display
|
80
|
+
if(element.nodeType==1){
|
81
|
+
str+= displayNode(element,level,checkForChildren(element));
|
82
|
+
str+=treeTraversal(element, level+1);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
return str;
|
86
|
+
}
|
87
|
+
|
88
|
+
function displayNode(element, level, isLink){
|
89
|
+
nodeContent = getNodeContent(element);
|
90
|
+
columns = Math.round((nodeContent.length / 12) + 0.5);
|
91
|
+
if (columns + level > maxColumns) {
|
92
|
+
maxColumns = columns + level;
|
93
|
+
}
|
94
|
+
var str ="<tr class='"+LEVEL+level+"'>";
|
95
|
+
for (var i=0; i < level; i++)
|
96
|
+
str+= "<td> </td>";
|
97
|
+
str+="<td colspan='"+ columns +"' class='box"+" boxlevel"+level+"' >";
|
98
|
+
if(isLink){
|
99
|
+
str+='<a onclick="hide(this);return false;" href="javascript:void();">';
|
100
|
+
str+='<img src="'+MIN_SRC+'" />';
|
101
|
+
}
|
102
|
+
str += nodeContent;
|
103
|
+
if(isLink)
|
104
|
+
str+="</a></td></tr>";
|
105
|
+
return str;
|
106
|
+
}
|
107
|
+
|
108
|
+
function getNodeContent(element) {
|
109
|
+
|
110
|
+
str = "";
|
111
|
+
id ="";
|
112
|
+
if (element.id != null && element.id != "") {
|
113
|
+
id = " ID(" + element.id +")";
|
114
|
+
}
|
115
|
+
name ="";
|
116
|
+
if (element.name != null && element.name != "") {
|
117
|
+
name = " NAME(" + element.name + ")";
|
118
|
+
}
|
119
|
+
value ="";
|
120
|
+
if (element.value != null && element.value != "") {
|
121
|
+
value = " VALUE(" + element.value + ")";
|
122
|
+
}
|
123
|
+
href ="";
|
124
|
+
if (element.href != null && element.href != "") {
|
125
|
+
href = " HREF(" + element.href + ")";
|
126
|
+
}
|
127
|
+
clazz = "";
|
128
|
+
if (element.className != null && element.className != "") {
|
129
|
+
clazz = " CLASS(" + element.className + ")";
|
130
|
+
}
|
131
|
+
src = "";
|
132
|
+
if (element.src != null && element.src != "") {
|
133
|
+
src = " SRC(" + element.src + ")";
|
134
|
+
}
|
135
|
+
alt = "";
|
136
|
+
if (element.alt != null && element.alt != "") {
|
137
|
+
alt = " ALT(" + element.alt + ")";
|
138
|
+
}
|
139
|
+
type = "";
|
140
|
+
if (element.type != null && element.type != "") {
|
141
|
+
type = " TYPE(" + element.type + ")";
|
142
|
+
}
|
143
|
+
text ="";
|
144
|
+
if (element.text != null && element.text != "" && element.text != "undefined") {
|
145
|
+
text = " #TEXT(" + trim(element.text) +")";
|
146
|
+
}
|
147
|
+
str+=" <b>"+ element.nodeName + id + alt + type + clazz + name + value + href + src + text + "</b>";
|
148
|
+
return str;
|
149
|
+
|
150
|
+
}
|
151
|
+
|
152
|
+
function trim(val) {
|
153
|
+
val2 = val.substring(0,40) + " ";
|
154
|
+
var spaceChr = String.fromCharCode(32);
|
155
|
+
var length = val2.length;
|
156
|
+
var retVal = "";
|
157
|
+
var ix = length -1;
|
158
|
+
|
159
|
+
while(ix > -1){
|
160
|
+
if(val2.charAt(ix) == spaceChr) {
|
161
|
+
} else {
|
162
|
+
retVal = val2.substring(0, ix +1);
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
ix = ix-1;
|
166
|
+
}
|
167
|
+
if (val.length > 40) {
|
168
|
+
retVal += "...";
|
169
|
+
}
|
170
|
+
return retVal;
|
171
|
+
}
|
172
|
+
|
173
|
+
function hide(hlink){
|
174
|
+
var isHidden = false;
|
175
|
+
var image = hlink.firstChild;
|
176
|
+
if(image.src.toString().indexOf(MIN_SRC)!=-1){
|
177
|
+
image.src=PLUS_SRC;
|
178
|
+
isHidden=true;
|
179
|
+
}else{
|
180
|
+
image.src=MIN_SRC;
|
181
|
+
}
|
182
|
+
var rowObj= hlink.parentNode.parentNode;
|
183
|
+
var rowLevel = parseInt(rowObj.className.substring(LEVEL.length));
|
184
|
+
|
185
|
+
var sibling = rowObj.nextSibling;
|
186
|
+
var siblingLevel = sibling.className.substring(LEVEL.length);
|
187
|
+
if(siblingLevel.indexOf(HIDDEN)!=-1){
|
188
|
+
siblingLevel = siblingLevel.substring(0,siblingLevel.length - HIDDEN.length-1);
|
189
|
+
}
|
190
|
+
siblingLevel=parseInt(siblingLevel);
|
191
|
+
while(sibling!=null && rowLevel<siblingLevel){
|
192
|
+
if(isHidden){
|
193
|
+
sibling.className += " "+ HIDDEN;
|
194
|
+
}else if(!isHidden && sibling.className.indexOf(HIDDEN)!=-1){
|
195
|
+
var str = sibling.className;
|
196
|
+
sibling.className=str.substring(0, str.length - HIDDEN.length-1);
|
197
|
+
}
|
198
|
+
sibling = sibling.nextSibling;
|
199
|
+
siblingLevel = parseInt(sibling.className.substring(LEVEL.length));
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
function LOG(message) {
|
204
|
+
window.opener.LOG.warn(message);
|
205
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,1515 @@
|
|
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
|
+
</ul>
|
83
|
+
|
84
|
+
<p>
|
85
|
+
Without an explicit locator prefix, Selenium uses the following default
|
86
|
+
strategies:
|
87
|
+
</p>
|
88
|
+
|
89
|
+
<ul class="simple">
|
90
|
+
<li><strong>dom</strong>, for locators starting with "document."</li>
|
91
|
+
<li><strong>xpath</strong>, for locators starting with "//"</li>
|
92
|
+
<li><strong>identifier</strong>, otherwise</li>
|
93
|
+
</ul>
|
94
|
+
|
95
|
+
<h3><a name="element-filters">Element Filters</a></h3>
|
96
|
+
<blockquote>
|
97
|
+
<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>
|
98
|
+
<p>Filters look much like locators, ie.</p>
|
99
|
+
<blockquote>
|
100
|
+
<em>filterType</em><strong>=</strong><em>argument</em></blockquote>
|
101
|
+
|
102
|
+
<p>Supported element-filters are:</p>
|
103
|
+
<p><strong>value=</strong><em>valuePattern</em></p>
|
104
|
+
<blockquote>
|
105
|
+
Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.</blockquote>
|
106
|
+
<p><strong>index=</strong><em>index</em></p>
|
107
|
+
<blockquote>
|
108
|
+
Selects a single element based on its position in the list (offset from zero).</blockquote>
|
109
|
+
</blockquote>
|
110
|
+
|
111
|
+
<h3><a name="patterns"></a>String-match Patterns</h3>
|
112
|
+
|
113
|
+
<p>
|
114
|
+
Various Pattern syntaxes are available for matching string values:
|
115
|
+
</p>
|
116
|
+
<ul>
|
117
|
+
<li><strong>glob:</strong><em>pattern</em>:
|
118
|
+
Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
|
119
|
+
kind of limited regular-expression syntax typically used in command-line
|
120
|
+
shells. In a glob pattern, "*" represents any sequence of characters, and "?"
|
121
|
+
represents any single character. Glob patterns match against the entire
|
122
|
+
string.</li>
|
123
|
+
<li><strong>regexp:</strong><em>regexp</em>:
|
124
|
+
Match a string using a regular-expression. The full power of JavaScript
|
125
|
+
regular-expressions is available.</li>
|
126
|
+
<li><strong>exact:</strong><em>string</em>:
|
127
|
+
|
128
|
+
Match a string exactly, verbatim, without any of that fancy wildcard
|
129
|
+
stuff.</li>
|
130
|
+
</ul>
|
131
|
+
<p>
|
132
|
+
If no pattern prefix is specified, Selenium assumes that it's a "glob"
|
133
|
+
pattern.
|
134
|
+
</p></top>
|
135
|
+
|
136
|
+
<function name="click">
|
137
|
+
|
138
|
+
<param name="locator">an element locator</param>
|
139
|
+
|
140
|
+
<comment>Clicks on a link, button, checkbox or radio button. If the click action
|
141
|
+
causes a new page to load (like a link usually does), call
|
142
|
+
waitForPageToLoad.</comment>
|
143
|
+
|
144
|
+
</function>
|
145
|
+
|
146
|
+
<function name="doubleClick">
|
147
|
+
|
148
|
+
<param name="locator">an element locator</param>
|
149
|
+
|
150
|
+
<comment>Double clicks on a link, button, checkbox or radio button. If the double click action
|
151
|
+
causes a new page to load (like a link usually does), call
|
152
|
+
waitForPageToLoad.</comment>
|
153
|
+
|
154
|
+
</function>
|
155
|
+
|
156
|
+
<function name="clickAt">
|
157
|
+
|
158
|
+
<param name="locator">an element locator</param>
|
159
|
+
|
160
|
+
<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>
|
161
|
+
|
162
|
+
<comment>Clicks on a link, button, checkbox or radio button. If the click action
|
163
|
+
causes a new page to load (like a link usually does), call
|
164
|
+
waitForPageToLoad.</comment>
|
165
|
+
|
166
|
+
</function>
|
167
|
+
|
168
|
+
<function name="doubleClickAt">
|
169
|
+
|
170
|
+
<param name="locator">an element locator</param>
|
171
|
+
|
172
|
+
<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>
|
173
|
+
|
174
|
+
<comment>Doubleclicks on a link, button, checkbox or radio button. If the action
|
175
|
+
causes a new page to load (like a link usually does), call
|
176
|
+
waitForPageToLoad.</comment>
|
177
|
+
|
178
|
+
</function>
|
179
|
+
|
180
|
+
<function name="fireEvent">
|
181
|
+
|
182
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
183
|
+
|
184
|
+
<param name="eventName">the event name, e.g. "focus" or "blur"</param>
|
185
|
+
|
186
|
+
<comment>Explicitly simulate an event, to trigger the corresponding "on<em>event</em>"
|
187
|
+
handler.</comment>
|
188
|
+
|
189
|
+
</function>
|
190
|
+
|
191
|
+
<function name="keyPress">
|
192
|
+
|
193
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
194
|
+
|
195
|
+
<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>
|
196
|
+
|
197
|
+
<comment>Simulates a user pressing and releasing a key.</comment>
|
198
|
+
|
199
|
+
</function>
|
200
|
+
|
201
|
+
<function name="shiftKeyDown">
|
202
|
+
|
203
|
+
<comment>Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.</comment>
|
204
|
+
|
205
|
+
</function>
|
206
|
+
|
207
|
+
<function name="shiftKeyUp">
|
208
|
+
|
209
|
+
<comment>Release the shift key.</comment>
|
210
|
+
|
211
|
+
</function>
|
212
|
+
|
213
|
+
<function name="metaKeyDown">
|
214
|
+
|
215
|
+
<comment>Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.</comment>
|
216
|
+
|
217
|
+
</function>
|
218
|
+
|
219
|
+
<function name="metaKeyUp">
|
220
|
+
|
221
|
+
<comment>Release the meta key.</comment>
|
222
|
+
|
223
|
+
</function>
|
224
|
+
|
225
|
+
<function name="altKeyDown">
|
226
|
+
|
227
|
+
<comment>Press the alt key and hold it down until doAltUp() is called or a new page is loaded.</comment>
|
228
|
+
|
229
|
+
</function>
|
230
|
+
|
231
|
+
<function name="altKeyUp">
|
232
|
+
|
233
|
+
<comment>Release the alt key.</comment>
|
234
|
+
|
235
|
+
</function>
|
236
|
+
|
237
|
+
<function name="controlKeyDown">
|
238
|
+
|
239
|
+
<comment>Press the control key and hold it down until doControlUp() is called or a new page is loaded.</comment>
|
240
|
+
|
241
|
+
</function>
|
242
|
+
|
243
|
+
<function name="controlKeyUp">
|
244
|
+
|
245
|
+
<comment>Release the control key.</comment>
|
246
|
+
|
247
|
+
</function>
|
248
|
+
|
249
|
+
<function name="keyDown">
|
250
|
+
|
251
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
252
|
+
|
253
|
+
<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>
|
254
|
+
|
255
|
+
<comment>Simulates a user pressing a key (without releasing it yet).</comment>
|
256
|
+
|
257
|
+
</function>
|
258
|
+
|
259
|
+
<function name="keyUp">
|
260
|
+
|
261
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
262
|
+
|
263
|
+
<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>
|
264
|
+
|
265
|
+
<comment>Simulates a user releasing a key.</comment>
|
266
|
+
|
267
|
+
</function>
|
268
|
+
|
269
|
+
<function name="mouseOver">
|
270
|
+
|
271
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
272
|
+
|
273
|
+
<comment>Simulates a user hovering a mouse over the specified element.</comment>
|
274
|
+
|
275
|
+
</function>
|
276
|
+
|
277
|
+
<function name="mouseOut">
|
278
|
+
|
279
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
280
|
+
|
281
|
+
<comment>Simulates a user moving the mouse pointer away from the specified element.</comment>
|
282
|
+
|
283
|
+
</function>
|
284
|
+
|
285
|
+
<function name="mouseDown">
|
286
|
+
|
287
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
288
|
+
|
289
|
+
<comment>Simulates a user pressing the mouse button (without releasing it yet) on
|
290
|
+
the specified element.</comment>
|
291
|
+
|
292
|
+
</function>
|
293
|
+
|
294
|
+
<function name="mouseDownAt">
|
295
|
+
|
296
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
297
|
+
|
298
|
+
<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>
|
299
|
+
|
300
|
+
<comment>Simulates a user pressing the mouse button (without releasing it yet) at
|
301
|
+
the specified location.</comment>
|
302
|
+
|
303
|
+
</function>
|
304
|
+
|
305
|
+
<function name="mouseUp">
|
306
|
+
|
307
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
308
|
+
|
309
|
+
<comment>Simulates the event that occurs when the user releases the mouse button (i.e., stops
|
310
|
+
holding the button down) on the specified element.</comment>
|
311
|
+
|
312
|
+
</function>
|
313
|
+
|
314
|
+
<function name="mouseUpAt">
|
315
|
+
|
316
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
317
|
+
|
318
|
+
<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>
|
319
|
+
|
320
|
+
<comment>Simulates the event that occurs when the user releases the mouse button (i.e., stops
|
321
|
+
holding the button down) at the specified location.</comment>
|
322
|
+
|
323
|
+
</function>
|
324
|
+
|
325
|
+
<function name="mouseMove">
|
326
|
+
|
327
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
328
|
+
|
329
|
+
<comment>Simulates a user pressing the mouse button (without releasing it yet) on
|
330
|
+
the specified element.</comment>
|
331
|
+
|
332
|
+
</function>
|
333
|
+
|
334
|
+
<function name="mouseMoveAt">
|
335
|
+
|
336
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
337
|
+
|
338
|
+
<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>
|
339
|
+
|
340
|
+
<comment>Simulates a user pressing the mouse button (without releasing it yet) on
|
341
|
+
the specified element.</comment>
|
342
|
+
|
343
|
+
</function>
|
344
|
+
|
345
|
+
<function name="type">
|
346
|
+
|
347
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
348
|
+
|
349
|
+
<param name="value">the value to type</param>
|
350
|
+
|
351
|
+
<comment>Sets the value of an input field, as though you typed it in.
|
352
|
+
|
353
|
+
<p>Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
|
354
|
+
value should be the value of the option selected, not the visible text.</p></comment>
|
355
|
+
|
356
|
+
</function>
|
357
|
+
|
358
|
+
<function name="typeKeys">
|
359
|
+
|
360
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
361
|
+
|
362
|
+
<param name="value">the value to type</param>
|
363
|
+
|
364
|
+
<comment>Simulates keystroke events on the specified element, as though you typed the value key-by-key.
|
365
|
+
|
366
|
+
<p>This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
|
367
|
+
this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.</p>
|
368
|
+
|
369
|
+
<p>Unlike the simple "type" command, which forces the specified value into the page directly, this command
|
370
|
+
may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
|
371
|
+
For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
|
372
|
+
the field.</p>
|
373
|
+
<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
|
374
|
+
send the keystroke events corresponding to what you just typed.</p></comment>
|
375
|
+
|
376
|
+
</function>
|
377
|
+
|
378
|
+
<function name="setSpeed">
|
379
|
+
|
380
|
+
<param name="value">the number of milliseconds to pause after operation</param>
|
381
|
+
|
382
|
+
<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.,
|
383
|
+
the delay is 0 milliseconds.</comment>
|
384
|
+
|
385
|
+
</function>
|
386
|
+
|
387
|
+
<function name="getSpeed">
|
388
|
+
|
389
|
+
<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.,
|
390
|
+
the delay is 0 milliseconds.
|
391
|
+
|
392
|
+
See also setSpeed.</comment>
|
393
|
+
|
394
|
+
</function>
|
395
|
+
|
396
|
+
<function name="check">
|
397
|
+
|
398
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
399
|
+
|
400
|
+
<comment>Check a toggle-button (checkbox/radio)</comment>
|
401
|
+
|
402
|
+
</function>
|
403
|
+
|
404
|
+
<function name="uncheck">
|
405
|
+
|
406
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
407
|
+
|
408
|
+
<comment>Uncheck a toggle-button (checkbox/radio)</comment>
|
409
|
+
|
410
|
+
</function>
|
411
|
+
|
412
|
+
<function name="select">
|
413
|
+
|
414
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
415
|
+
|
416
|
+
<param name="optionLocator">an option locator (a label by default)</param>
|
417
|
+
|
418
|
+
<comment>Select an option from a drop-down using an option locator.
|
419
|
+
|
420
|
+
<p>
|
421
|
+
Option locators provide different ways of specifying options of an HTML
|
422
|
+
Select element (e.g. for selecting a specific option, or for asserting
|
423
|
+
that the selected option satisfies a specification). There are several
|
424
|
+
forms of Select Option Locator.
|
425
|
+
</p>
|
426
|
+
<ul>
|
427
|
+
<li><strong>label</strong>=<em>labelPattern</em>:
|
428
|
+
matches options based on their labels, i.e. the visible text. (This
|
429
|
+
is the default.)
|
430
|
+
<ul class="first last simple">
|
431
|
+
<li>label=regexp:^[Oo]ther</li>
|
432
|
+
</ul>
|
433
|
+
</li>
|
434
|
+
<li><strong>value</strong>=<em>valuePattern</em>:
|
435
|
+
matches options based on their values.
|
436
|
+
<ul class="first last simple">
|
437
|
+
<li>value=other</li>
|
438
|
+
</ul>
|
439
|
+
|
440
|
+
|
441
|
+
</li>
|
442
|
+
<li><strong>id</strong>=<em>id</em>:
|
443
|
+
|
444
|
+
matches options based on their ids.
|
445
|
+
<ul class="first last simple">
|
446
|
+
<li>id=option1</li>
|
447
|
+
</ul>
|
448
|
+
</li>
|
449
|
+
<li><strong>index</strong>=<em>index</em>:
|
450
|
+
matches an option based on its index (offset from zero).
|
451
|
+
<ul class="first last simple">
|
452
|
+
|
453
|
+
<li>index=2</li>
|
454
|
+
</ul>
|
455
|
+
</li>
|
456
|
+
</ul>
|
457
|
+
<p>
|
458
|
+
If no option locator prefix is provided, the default behaviour is to match on <strong>label</strong>.
|
459
|
+
</p></comment>
|
460
|
+
|
461
|
+
</function>
|
462
|
+
|
463
|
+
<function name="addSelection">
|
464
|
+
|
465
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a multi-select box</param>
|
466
|
+
|
467
|
+
<param name="optionLocator">an option locator (a label by default)</param>
|
468
|
+
|
469
|
+
<comment>Add a selection to the set of selected options in a multi-select element using an option locator.
|
470
|
+
|
471
|
+
@see #doSelect for details of option locators</comment>
|
472
|
+
|
473
|
+
</function>
|
474
|
+
|
475
|
+
<function name="removeSelection">
|
476
|
+
|
477
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a multi-select box</param>
|
478
|
+
|
479
|
+
<param name="optionLocator">an option locator (a label by default)</param>
|
480
|
+
|
481
|
+
<comment>Remove a selection from the set of selected options in a multi-select element using an option locator.
|
482
|
+
|
483
|
+
@see #doSelect for details of option locators</comment>
|
484
|
+
|
485
|
+
</function>
|
486
|
+
|
487
|
+
<function name="removeAllSelections">
|
488
|
+
|
489
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a multi-select box</param>
|
490
|
+
|
491
|
+
<comment>Unselects all of the selected options in a multi-select element.</comment>
|
492
|
+
|
493
|
+
</function>
|
494
|
+
|
495
|
+
<function name="submit">
|
496
|
+
|
497
|
+
<param name="formLocator">an <a href="#locators">element locator</a> for the form you want to submit</param>
|
498
|
+
|
499
|
+
<comment>Submit the specified form. This is particularly useful for forms without
|
500
|
+
submit buttons, e.g. single-input "Search" forms.</comment>
|
501
|
+
|
502
|
+
</function>
|
503
|
+
|
504
|
+
<function name="open">
|
505
|
+
|
506
|
+
<param name="url">the URL to open; may be relative or absolute</param>
|
507
|
+
|
508
|
+
<comment>Opens an URL in the test frame. This accepts both relative and absolute
|
509
|
+
URLs.
|
510
|
+
|
511
|
+
The "open" command waits for the page to load before proceeding,
|
512
|
+
ie. the "AndWait" suffix is implicit.
|
513
|
+
|
514
|
+
<em>Note</em>: The URL must be on the same domain as the runner HTML
|
515
|
+
due to security restrictions in the browser (Same Origin Policy). If you
|
516
|
+
need to open an URL on another domain, use the Selenium Server to start a
|
517
|
+
new browser session on that domain.</comment>
|
518
|
+
|
519
|
+
</function>
|
520
|
+
|
521
|
+
<function name="openWindow">
|
522
|
+
|
523
|
+
<param name="url">the URL to open, which can be blank</param>
|
524
|
+
|
525
|
+
<param name="windowID">the JavaScript window ID of the window to select</param>
|
526
|
+
|
527
|
+
<comment>Opens a popup window (if a window with that ID isn't already open).
|
528
|
+
After opening the window, you'll need to select it using the selectWindow
|
529
|
+
command.
|
530
|
+
|
531
|
+
<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).
|
532
|
+
In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
|
533
|
+
an empty (blank) url, like this: openWindow("", "myFunnyWindow").</p></comment>
|
534
|
+
|
535
|
+
</function>
|
536
|
+
|
537
|
+
<function name="selectWindow">
|
538
|
+
|
539
|
+
<param name="windowID">the JavaScript window ID of the window to select</param>
|
540
|
+
|
541
|
+
<comment>Selects a popup window; once a popup window has been selected, all
|
542
|
+
commands go to that window. To select the main window again, use null
|
543
|
+
as the target.
|
544
|
+
|
545
|
+
<p>Note that there is a big difference between a window's internal JavaScript "name" property
|
546
|
+
and the "title" of a given window's document (which is normally what you actually see, as an end user,
|
547
|
+
in the title bar of the window). The "name" is normally invisible to the end-user; it's the second
|
548
|
+
parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
|
549
|
+
(which selenium intercepts).</p>
|
550
|
+
|
551
|
+
<p>Selenium has several strategies for finding the window object referred to by the "windowID" parameter.</p>
|
552
|
+
|
553
|
+
<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>
|
554
|
+
<p>2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
|
555
|
+
that this variable contains the return value from a call to the JavaScript window.open() method.</p>
|
556
|
+
<p>3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".</p>
|
557
|
+
<p>4.) If <i>that</i> fails, we'll try looping over all of the known windows to try to find the appropriate "title".
|
558
|
+
Since "title" is not necessarily unique, this may have unexpected behavior.</p>
|
559
|
+
|
560
|
+
<p>If you're having trouble figuring out what is the name of a window that you want to manipulate, look at the selenium log messages
|
561
|
+
which identify the names of windows created via window.open (and therefore intercepted by selenium). You will see messages
|
562
|
+
like the following for each window as it is opened:</p>
|
563
|
+
|
564
|
+
<p><code>debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"</code></p>
|
565
|
+
|
566
|
+
<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).
|
567
|
+
(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
|
568
|
+
an empty (blank) url, like this: openWindow("", "myFunnyWindow").</p></comment>
|
569
|
+
|
570
|
+
</function>
|
571
|
+
|
572
|
+
<function name="selectFrame">
|
573
|
+
|
574
|
+
<param name="locator">an <a href="#locators">element locator</a> identifying a frame or iframe</param>
|
575
|
+
|
576
|
+
<comment>Selects a frame within the current window. (You may invoke this command
|
577
|
+
multiple times to select nested frames.) To select the parent frame, use
|
578
|
+
"relative=parent" as a locator; to select the top frame, use "relative=top".
|
579
|
+
You can also select a frame by its 0-based index number; select the first frame with
|
580
|
+
"index=0", or the third frame with "index=2".
|
581
|
+
|
582
|
+
<p>You may also use a DOM expression to identify the frame you want directly,
|
583
|
+
like this: <code>dom=frames["main"].frames["subframe"]</code></p></comment>
|
584
|
+
|
585
|
+
</function>
|
586
|
+
|
587
|
+
<function name="getWhetherThisFrameMatchFrameExpression">
|
588
|
+
|
589
|
+
<return type="boolean">true if the new frame is this code's window</return>
|
590
|
+
|
591
|
+
<param name="currentFrameString">starting frame</param>
|
592
|
+
|
593
|
+
<param name="target">new frame (which might be relative to the current one)</param>
|
594
|
+
|
595
|
+
<comment>Determine whether current/locator identify the frame containing this running code.
|
596
|
+
|
597
|
+
<p>This is useful in proxy injection mode, where this code runs in every
|
598
|
+
browser frame and window, and sometimes the selenium server needs to identify
|
599
|
+
the "current" frame. In this case, when the test calls selectFrame, this
|
600
|
+
routine is called for each frame to figure out which one has been selected.
|
601
|
+
The selected frame will return true, while all others will return false.</p></comment>
|
602
|
+
|
603
|
+
</function>
|
604
|
+
|
605
|
+
<function name="getWhetherThisWindowMatchWindowExpression">
|
606
|
+
|
607
|
+
<return type="boolean">true if the new window is this code's window</return>
|
608
|
+
|
609
|
+
<param name="currentWindowString">starting window</param>
|
610
|
+
|
611
|
+
<param name="target">new window (which might be relative to the current one, e.g., "_parent")</param>
|
612
|
+
|
613
|
+
<comment>Determine whether currentWindowString plus target identify the window containing this running code.
|
614
|
+
|
615
|
+
<p>This is useful in proxy injection mode, where this code runs in every
|
616
|
+
browser frame and window, and sometimes the selenium server needs to identify
|
617
|
+
the "current" window. In this case, when the test calls selectWindow, this
|
618
|
+
routine is called for each window to figure out which one has been selected.
|
619
|
+
The selected window will return true, while all others will return false.</p></comment>
|
620
|
+
|
621
|
+
</function>
|
622
|
+
|
623
|
+
<function name="waitForPopUp">
|
624
|
+
|
625
|
+
<param name="windowID">the JavaScript window ID of the window that will appear</param>
|
626
|
+
|
627
|
+
<param name="timeout">a timeout in milliseconds, after which the action will return with an error</param>
|
628
|
+
|
629
|
+
<comment>Waits for a popup window to appear and load up.</comment>
|
630
|
+
|
631
|
+
</function>
|
632
|
+
|
633
|
+
<function name="chooseCancelOnNextConfirmation">
|
634
|
+
|
635
|
+
<comment>By default, Selenium's overridden window.confirm() function will
|
636
|
+
return true, as if the user had manually clicked OK; after running
|
637
|
+
this command, the next call to confirm() will return false, as if
|
638
|
+
the user had clicked Cancel. Selenium will then resume using the
|
639
|
+
default behavior for future confirmations, automatically returning
|
640
|
+
true (OK) unless/until you explicitly call this command for each
|
641
|
+
confirmation.</comment>
|
642
|
+
|
643
|
+
</function>
|
644
|
+
|
645
|
+
<function name="chooseOkOnNextConfirmation">
|
646
|
+
|
647
|
+
<comment>Undo the effect of calling chooseCancelOnNextConfirmation. Note
|
648
|
+
that Selenium's overridden window.confirm() function will normally automatically
|
649
|
+
return true, as if the user had manually clicked OK, so you shouldn't
|
650
|
+
need to use this command unless for some reason you need to change
|
651
|
+
your mind prior to the next confirmation. After any confirmation, Selenium will resume using the
|
652
|
+
default behavior for future confirmations, automatically returning
|
653
|
+
true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
|
654
|
+
confirmation.</comment>
|
655
|
+
|
656
|
+
</function>
|
657
|
+
|
658
|
+
<function name="answerOnNextPrompt">
|
659
|
+
|
660
|
+
<param name="answer">the answer to give in response to the prompt pop-up</param>
|
661
|
+
|
662
|
+
<comment>Instructs Selenium to return the specified answer string in response to
|
663
|
+
the next JavaScript prompt [window.prompt()].</comment>
|
664
|
+
|
665
|
+
</function>
|
666
|
+
|
667
|
+
<function name="goBack">
|
668
|
+
|
669
|
+
<comment>Simulates the user clicking the "back" button on their browser.</comment>
|
670
|
+
|
671
|
+
</function>
|
672
|
+
|
673
|
+
<function name="refresh">
|
674
|
+
|
675
|
+
<comment>Simulates the user clicking the "Refresh" button on their browser.</comment>
|
676
|
+
|
677
|
+
</function>
|
678
|
+
|
679
|
+
<function name="close">
|
680
|
+
|
681
|
+
<comment>Simulates the user clicking the "close" button in the titlebar of a popup
|
682
|
+
window or tab.</comment>
|
683
|
+
|
684
|
+
</function>
|
685
|
+
|
686
|
+
<function name="isAlertPresent">
|
687
|
+
|
688
|
+
<return type="boolean">true if there is an alert</return>
|
689
|
+
|
690
|
+
<comment>Has an alert occurred?
|
691
|
+
|
692
|
+
<p>
|
693
|
+
This function never throws an exception
|
694
|
+
</p></comment>
|
695
|
+
|
696
|
+
</function>
|
697
|
+
|
698
|
+
<function name="isPromptPresent">
|
699
|
+
|
700
|
+
<return type="boolean">true if there is a pending prompt</return>
|
701
|
+
|
702
|
+
<comment>Has a prompt occurred?
|
703
|
+
|
704
|
+
<p>
|
705
|
+
This function never throws an exception
|
706
|
+
</p></comment>
|
707
|
+
|
708
|
+
</function>
|
709
|
+
|
710
|
+
<function name="isConfirmationPresent">
|
711
|
+
|
712
|
+
<return type="boolean">true if there is a pending confirmation</return>
|
713
|
+
|
714
|
+
<comment>Has confirm() been called?
|
715
|
+
|
716
|
+
<p>
|
717
|
+
This function never throws an exception
|
718
|
+
</p></comment>
|
719
|
+
|
720
|
+
</function>
|
721
|
+
|
722
|
+
<function name="getAlert">
|
723
|
+
|
724
|
+
<return type="string">The message of the most recent JavaScript alert</return>
|
725
|
+
|
726
|
+
<comment>Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
|
727
|
+
|
728
|
+
<p>Getting an alert has the same effect as manually clicking OK. If an
|
729
|
+
alert is generated but you do not get/verify it, the next Selenium action
|
730
|
+
will fail.</p>
|
731
|
+
|
732
|
+
<p>NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
|
733
|
+
dialog.</p>
|
734
|
+
|
735
|
+
<p>NOTE: Selenium does NOT support JavaScript alerts that are generated in a
|
736
|
+
page's onload() event handler. In this case a visible dialog WILL be
|
737
|
+
generated and Selenium will hang until someone manually clicks OK.</p></comment>
|
738
|
+
|
739
|
+
</function>
|
740
|
+
|
741
|
+
<function name="getConfirmation">
|
742
|
+
|
743
|
+
<return type="string">the message of the most recent JavaScript confirmation dialog</return>
|
744
|
+
|
745
|
+
<comment>Retrieves the message of a JavaScript confirmation dialog generated during
|
746
|
+
the previous action.
|
747
|
+
|
748
|
+
<p>
|
749
|
+
By default, the confirm function will return true, having the same effect
|
750
|
+
as manually clicking OK. This can be changed by prior execution of the
|
751
|
+
chooseCancelOnNextConfirmation command. If an confirmation is generated
|
752
|
+
but you do not get/verify it, the next Selenium action will fail.
|
753
|
+
</p>
|
754
|
+
|
755
|
+
<p>
|
756
|
+
NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
|
757
|
+
dialog.
|
758
|
+
</p>
|
759
|
+
|
760
|
+
<p>
|
761
|
+
NOTE: Selenium does NOT support JavaScript confirmations that are
|
762
|
+
generated in a page's onload() event handler. In this case a visible
|
763
|
+
dialog WILL be generated and Selenium will hang until you manually click
|
764
|
+
OK.
|
765
|
+
</p></comment>
|
766
|
+
|
767
|
+
</function>
|
768
|
+
|
769
|
+
<function name="getPrompt">
|
770
|
+
|
771
|
+
<return type="string">the message of the most recent JavaScript question prompt</return>
|
772
|
+
|
773
|
+
<comment>Retrieves the message of a JavaScript question prompt dialog generated during
|
774
|
+
the previous action.
|
775
|
+
|
776
|
+
<p>Successful handling of the prompt requires prior execution of the
|
777
|
+
answerOnNextPrompt command. If a prompt is generated but you
|
778
|
+
do not get/verify it, the next Selenium action will fail.</p>
|
779
|
+
|
780
|
+
<p>NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
|
781
|
+
dialog.</p>
|
782
|
+
|
783
|
+
<p>NOTE: Selenium does NOT support JavaScript prompts that are generated in a
|
784
|
+
page's onload() event handler. In this case a visible dialog WILL be
|
785
|
+
generated and Selenium will hang until someone manually clicks OK.</p></comment>
|
786
|
+
|
787
|
+
</function>
|
788
|
+
|
789
|
+
<function name="getLocation">
|
790
|
+
|
791
|
+
<return type="string">the absolute URL of the current page</return>
|
792
|
+
|
793
|
+
<comment>Gets the absolute URL of the current page.</comment>
|
794
|
+
|
795
|
+
</function>
|
796
|
+
|
797
|
+
<function name="getTitle">
|
798
|
+
|
799
|
+
<return type="string">the title of the current page</return>
|
800
|
+
|
801
|
+
<comment>Gets the title of the current page.</comment>
|
802
|
+
|
803
|
+
</function>
|
804
|
+
|
805
|
+
<function name="getBodyText">
|
806
|
+
|
807
|
+
<return type="string">the entire text of the page</return>
|
808
|
+
|
809
|
+
<comment>Gets the entire text of the page.</comment>
|
810
|
+
|
811
|
+
</function>
|
812
|
+
|
813
|
+
<function name="getValue">
|
814
|
+
|
815
|
+
<return type="string">the element value, or "on/off" for checkbox/radio elements</return>
|
816
|
+
|
817
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
818
|
+
|
819
|
+
<comment>Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
|
820
|
+
For checkbox/radio elements, the value will be "on" or "off" depending on
|
821
|
+
whether the element is checked or not.</comment>
|
822
|
+
|
823
|
+
</function>
|
824
|
+
|
825
|
+
<function name="getText">
|
826
|
+
|
827
|
+
<return type="string">the text of the element</return>
|
828
|
+
|
829
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
830
|
+
|
831
|
+
<comment>Gets the text of an element. This works for any element that contains
|
832
|
+
text. This command uses either the textContent (Mozilla-like browsers) or
|
833
|
+
the innerText (IE-like browsers) of the element, which is the rendered
|
834
|
+
text shown to the user.</comment>
|
835
|
+
|
836
|
+
</function>
|
837
|
+
|
838
|
+
<function name="highlight">
|
839
|
+
|
840
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
841
|
+
|
842
|
+
<comment>Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.</comment>
|
843
|
+
|
844
|
+
</function>
|
845
|
+
|
846
|
+
<function name="getEval">
|
847
|
+
|
848
|
+
<return type="string">the results of evaluating the snippet</return>
|
849
|
+
|
850
|
+
<param name="script">the JavaScript snippet to run</param>
|
851
|
+
|
852
|
+
<comment>Gets the result of evaluating the specified JavaScript snippet. The snippet may
|
853
|
+
have multiple lines, but only the result of the last line will be returned.
|
854
|
+
|
855
|
+
<p>Note that, by default, the snippet will run in the context of the "selenium"
|
856
|
+
object itself, so <code>this</code> will refer to the Selenium object. Use <code>window</code> to
|
857
|
+
refer to the window of your application, e.g. <code>window.document.getElementById('foo')</code></p>
|
858
|
+
|
859
|
+
<p>If you need to use
|
860
|
+
a locator to refer to a single element in your application page, you can
|
861
|
+
use <code>this.browserbot.findElement("id=foo")</code> where "id=foo" is your locator.</p></comment>
|
862
|
+
|
863
|
+
</function>
|
864
|
+
|
865
|
+
<function name="isChecked">
|
866
|
+
|
867
|
+
<return type="boolean">true if the checkbox is checked, false otherwise</return>
|
868
|
+
|
869
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to a checkbox or radio button</param>
|
870
|
+
|
871
|
+
<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>
|
872
|
+
|
873
|
+
</function>
|
874
|
+
|
875
|
+
<function name="getTable">
|
876
|
+
|
877
|
+
<return type="string">the text from the specified cell</return>
|
878
|
+
|
879
|
+
<param name="tableCellAddress">a cell address, e.g. "foo.1.4"</param>
|
880
|
+
|
881
|
+
<comment>Gets the text from a cell of a table. The cellAddress syntax
|
882
|
+
tableLocator.row.column, where row and column start at 0.</comment>
|
883
|
+
|
884
|
+
</function>
|
885
|
+
|
886
|
+
<function name="getSelectedLabels">
|
887
|
+
|
888
|
+
<return type="string[]">an array of all selected option labels in the specified select drop-down</return>
|
889
|
+
|
890
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
891
|
+
|
892
|
+
<comment>Gets all option labels (visible text) for selected options in the specified select or multi-select element.</comment>
|
893
|
+
|
894
|
+
</function>
|
895
|
+
|
896
|
+
<function name="getSelectedLabel">
|
897
|
+
|
898
|
+
<return type="string">the selected option label in the specified select drop-down</return>
|
899
|
+
|
900
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
901
|
+
|
902
|
+
<comment>Gets option label (visible text) for selected option in the specified select element.</comment>
|
903
|
+
|
904
|
+
</function>
|
905
|
+
|
906
|
+
<function name="getSelectedValues">
|
907
|
+
|
908
|
+
<return type="string[]">an array of all selected option values in the specified select drop-down</return>
|
909
|
+
|
910
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
911
|
+
|
912
|
+
<comment>Gets all option values (value attributes) for selected options in the specified select or multi-select element.</comment>
|
913
|
+
|
914
|
+
</function>
|
915
|
+
|
916
|
+
<function name="getSelectedValue">
|
917
|
+
|
918
|
+
<return type="string">the selected option value in the specified select drop-down</return>
|
919
|
+
|
920
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
921
|
+
|
922
|
+
<comment>Gets option value (value attribute) for selected option in the specified select element.</comment>
|
923
|
+
|
924
|
+
</function>
|
925
|
+
|
926
|
+
<function name="getSelectedIndexes">
|
927
|
+
|
928
|
+
<return type="string[]">an array of all selected option indexes in the specified select drop-down</return>
|
929
|
+
|
930
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
931
|
+
|
932
|
+
<comment>Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.</comment>
|
933
|
+
|
934
|
+
</function>
|
935
|
+
|
936
|
+
<function name="getSelectedIndex">
|
937
|
+
|
938
|
+
<return type="string">the selected option index in the specified select drop-down</return>
|
939
|
+
|
940
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
941
|
+
|
942
|
+
<comment>Gets option index (option number, starting at 0) for selected option in the specified select element.</comment>
|
943
|
+
|
944
|
+
</function>
|
945
|
+
|
946
|
+
<function name="getSelectedIds">
|
947
|
+
|
948
|
+
<return type="string[]">an array of all selected option IDs in the specified select drop-down</return>
|
949
|
+
|
950
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
951
|
+
|
952
|
+
<comment>Gets all option element IDs for selected options in the specified select or multi-select element.</comment>
|
953
|
+
|
954
|
+
</function>
|
955
|
+
|
956
|
+
<function name="getSelectedId">
|
957
|
+
|
958
|
+
<return type="string">the selected option ID in the specified select drop-down</return>
|
959
|
+
|
960
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
961
|
+
|
962
|
+
<comment>Gets option element ID for selected option in the specified select element.</comment>
|
963
|
+
|
964
|
+
</function>
|
965
|
+
|
966
|
+
<function name="isSomethingSelected">
|
967
|
+
|
968
|
+
<return type="boolean">true if some option has been selected, false otherwise</return>
|
969
|
+
|
970
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
971
|
+
|
972
|
+
<comment>Determines whether some option in a drop-down menu is selected.</comment>
|
973
|
+
|
974
|
+
</function>
|
975
|
+
|
976
|
+
<function name="getSelectOptions">
|
977
|
+
|
978
|
+
<return type="string[]">an array of all option labels in the specified select drop-down</return>
|
979
|
+
|
980
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
981
|
+
|
982
|
+
<comment>Gets all option labels in the specified select drop-down.</comment>
|
983
|
+
|
984
|
+
</function>
|
985
|
+
|
986
|
+
<function name="getAttribute">
|
987
|
+
|
988
|
+
<return type="string">the value of the specified attribute</return>
|
989
|
+
|
990
|
+
<param name="attributeLocator">an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"</param>
|
991
|
+
|
992
|
+
<comment>Gets the value of an element attribute.</comment>
|
993
|
+
|
994
|
+
</function>
|
995
|
+
|
996
|
+
<function name="isTextPresent">
|
997
|
+
|
998
|
+
<return type="boolean">true if the pattern matches the text, false otherwise</return>
|
999
|
+
|
1000
|
+
<param name="pattern">a <a href="#patterns">pattern</a> to match with the text of the page</param>
|
1001
|
+
|
1002
|
+
<comment>Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.</comment>
|
1003
|
+
|
1004
|
+
</function>
|
1005
|
+
|
1006
|
+
<function name="isElementPresent">
|
1007
|
+
|
1008
|
+
<return type="boolean">true if the element is present, false otherwise</return>
|
1009
|
+
|
1010
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
1011
|
+
|
1012
|
+
<comment>Verifies that the specified element is somewhere on the page.</comment>
|
1013
|
+
|
1014
|
+
</function>
|
1015
|
+
|
1016
|
+
<function name="isVisible">
|
1017
|
+
|
1018
|
+
<return type="boolean">true if the specified element is visible, false otherwise</return>
|
1019
|
+
|
1020
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
1021
|
+
|
1022
|
+
<comment>Determines if the specified element is visible. An
|
1023
|
+
element can be rendered invisible by setting the CSS "visibility"
|
1024
|
+
property to "hidden", or the "display" property to "none", either for the
|
1025
|
+
element itself or one if its ancestors. This method will fail if
|
1026
|
+
the element is not present.</comment>
|
1027
|
+
|
1028
|
+
</function>
|
1029
|
+
|
1030
|
+
<function name="isEditable">
|
1031
|
+
|
1032
|
+
<return type="boolean">true if the input element is editable, false otherwise</return>
|
1033
|
+
|
1034
|
+
<param name="locator">an <a href="#locators">element locator</a></param>
|
1035
|
+
|
1036
|
+
<comment>Determines whether the specified input element is editable, ie hasn't been disabled.
|
1037
|
+
This method will fail if the specified element isn't an input element.</comment>
|
1038
|
+
|
1039
|
+
</function>
|
1040
|
+
|
1041
|
+
<function name="getAllButtons">
|
1042
|
+
|
1043
|
+
<return type="string[]">the IDs of all buttons on the page</return>
|
1044
|
+
|
1045
|
+
<comment>Returns the IDs of all buttons on the page.
|
1046
|
+
|
1047
|
+
<p>If a given button has no ID, it will appear as "" in this array.</p></comment>
|
1048
|
+
|
1049
|
+
</function>
|
1050
|
+
|
1051
|
+
<function name="getAllLinks">
|
1052
|
+
|
1053
|
+
<return type="string[]">the IDs of all links on the page</return>
|
1054
|
+
|
1055
|
+
<comment>Returns the IDs of all links on the page.
|
1056
|
+
|
1057
|
+
<p>If a given link has no ID, it will appear as "" in this array.</p></comment>
|
1058
|
+
|
1059
|
+
</function>
|
1060
|
+
|
1061
|
+
<function name="getAllFields">
|
1062
|
+
|
1063
|
+
<return type="string[]">the IDs of all field on the page</return>
|
1064
|
+
|
1065
|
+
<comment>Returns the IDs of all input fields on the page.
|
1066
|
+
|
1067
|
+
<p>If a given field has no ID, it will appear as "" in this array.</p></comment>
|
1068
|
+
|
1069
|
+
</function>
|
1070
|
+
|
1071
|
+
<function name="getAttributeFromAllWindows">
|
1072
|
+
|
1073
|
+
<return type="string[]">the set of values of this attribute from all known windows.</return>
|
1074
|
+
|
1075
|
+
<param name="attributeName">name of an attribute on the windows</param>
|
1076
|
+
|
1077
|
+
<comment>Returns every instance of some attribute from all known windows.</comment>
|
1078
|
+
|
1079
|
+
</function>
|
1080
|
+
|
1081
|
+
<function name="dragdrop">
|
1082
|
+
|
1083
|
+
<param name="locator">an element locator</param>
|
1084
|
+
|
1085
|
+
<param name="movementsString">offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"</param>
|
1086
|
+
|
1087
|
+
<comment>deprecated - use dragAndDrop instead</comment>
|
1088
|
+
|
1089
|
+
</function>
|
1090
|
+
|
1091
|
+
<function name="setMouseSpeed">
|
1092
|
+
|
1093
|
+
<param name="pixels">the number of pixels between "mousemove" events</param>
|
1094
|
+
|
1095
|
+
<comment>Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
|
1096
|
+
<p>Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
|
1097
|
+
in between the start location and the end location; that can be very slow, and may
|
1098
|
+
cause some browsers to force the JavaScript to timeout.</p>
|
1099
|
+
|
1100
|
+
<p>If the mouse speed is greater than the distance between the two dragged objects, we'll
|
1101
|
+
just send one "mousemove" at the start location and then one final one at the end location.</p></comment>
|
1102
|
+
|
1103
|
+
</function>
|
1104
|
+
|
1105
|
+
<function name="getMouseSpeed">
|
1106
|
+
|
1107
|
+
<return type="number">the number of pixels between "mousemove" events during dragAndDrop commands (default=10)</return>
|
1108
|
+
|
1109
|
+
<comment>Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).</comment>
|
1110
|
+
|
1111
|
+
</function>
|
1112
|
+
|
1113
|
+
<function name="dragAndDrop">
|
1114
|
+
|
1115
|
+
<param name="locator">an element locator</param>
|
1116
|
+
|
1117
|
+
<param name="movementsString">offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"</param>
|
1118
|
+
|
1119
|
+
<comment>Drags an element a certain distance and then drops it</comment>
|
1120
|
+
|
1121
|
+
</function>
|
1122
|
+
|
1123
|
+
<function name="dragAndDropToObject">
|
1124
|
+
|
1125
|
+
<param name="locatorOfObjectToBeDragged">an element to be dragged</param>
|
1126
|
+
|
1127
|
+
<param name="locatorOfDragDestinationObject">an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped</param>
|
1128
|
+
|
1129
|
+
<comment>Drags an element and drops it on another element</comment>
|
1130
|
+
|
1131
|
+
</function>
|
1132
|
+
|
1133
|
+
<function name="windowFocus">
|
1134
|
+
|
1135
|
+
<comment>Gives focus to the currently selected window</comment>
|
1136
|
+
|
1137
|
+
</function>
|
1138
|
+
|
1139
|
+
<function name="windowMaximize">
|
1140
|
+
|
1141
|
+
<comment>Resize currently selected window to take up the entire screen</comment>
|
1142
|
+
|
1143
|
+
</function>
|
1144
|
+
|
1145
|
+
<function name="getAllWindowIds">
|
1146
|
+
|
1147
|
+
<return type="string[]">the IDs of all windows that the browser knows about.</return>
|
1148
|
+
|
1149
|
+
<comment>Returns the IDs of all windows that the browser knows about.</comment>
|
1150
|
+
|
1151
|
+
</function>
|
1152
|
+
|
1153
|
+
<function name="getAllWindowNames">
|
1154
|
+
|
1155
|
+
<return type="string[]">the names of all windows that the browser knows about.</return>
|
1156
|
+
|
1157
|
+
<comment>Returns the names of all windows that the browser knows about.</comment>
|
1158
|
+
|
1159
|
+
</function>
|
1160
|
+
|
1161
|
+
<function name="getAllWindowTitles">
|
1162
|
+
|
1163
|
+
<return type="string[]">the titles of all windows that the browser knows about.</return>
|
1164
|
+
|
1165
|
+
<comment>Returns the titles of all windows that the browser knows about.</comment>
|
1166
|
+
|
1167
|
+
</function>
|
1168
|
+
|
1169
|
+
<function name="getHtmlSource">
|
1170
|
+
|
1171
|
+
<return type="string">the entire HTML source</return>
|
1172
|
+
|
1173
|
+
<comment>Returns the entire HTML source between the opening and
|
1174
|
+
closing "html" tags.</comment>
|
1175
|
+
|
1176
|
+
</function>
|
1177
|
+
|
1178
|
+
<function name="setCursorPosition">
|
1179
|
+
|
1180
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an input element or textarea</param>
|
1181
|
+
|
1182
|
+
<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>
|
1183
|
+
|
1184
|
+
<comment>Moves the text cursor to the specified position in the given input element or textarea.
|
1185
|
+
This method will fail if the specified element isn't an input element or textarea.</comment>
|
1186
|
+
|
1187
|
+
</function>
|
1188
|
+
|
1189
|
+
<function name="getElementIndex">
|
1190
|
+
|
1191
|
+
<return type="number">of relative index of the element to its parent (starting from 0)</return>
|
1192
|
+
|
1193
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1194
|
+
|
1195
|
+
<comment>Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
|
1196
|
+
will be ignored.</comment>
|
1197
|
+
|
1198
|
+
</function>
|
1199
|
+
|
1200
|
+
<function name="isOrdered">
|
1201
|
+
|
1202
|
+
<return type="boolean">true if element1 is the previous sibling of element2, false otherwise</return>
|
1203
|
+
|
1204
|
+
<param name="locator1">an <a href="#locators">element locator</a> pointing to the first element</param>
|
1205
|
+
|
1206
|
+
<param name="locator2">an <a href="#locators">element locator</a> pointing to the second element</param>
|
1207
|
+
|
1208
|
+
<comment>Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
|
1209
|
+
not be considered ordered.</comment>
|
1210
|
+
|
1211
|
+
</function>
|
1212
|
+
|
1213
|
+
<function name="getElementPositionLeft">
|
1214
|
+
|
1215
|
+
<return type="number">of pixels from the edge of the frame.</return>
|
1216
|
+
|
1217
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element OR an element itself</param>
|
1218
|
+
|
1219
|
+
<comment>Retrieves the horizontal position of an element</comment>
|
1220
|
+
|
1221
|
+
</function>
|
1222
|
+
|
1223
|
+
<function name="getElementPositionTop">
|
1224
|
+
|
1225
|
+
<return type="number">of pixels from the edge of the frame.</return>
|
1226
|
+
|
1227
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element OR an element itself</param>
|
1228
|
+
|
1229
|
+
<comment>Retrieves the vertical position of an element</comment>
|
1230
|
+
|
1231
|
+
</function>
|
1232
|
+
|
1233
|
+
<function name="getElementWidth">
|
1234
|
+
|
1235
|
+
<return type="number">width of an element in pixels</return>
|
1236
|
+
|
1237
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1238
|
+
|
1239
|
+
<comment>Retrieves the width of an element</comment>
|
1240
|
+
|
1241
|
+
</function>
|
1242
|
+
|
1243
|
+
<function name="getElementHeight">
|
1244
|
+
|
1245
|
+
<return type="number">height of an element in pixels</return>
|
1246
|
+
|
1247
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1248
|
+
|
1249
|
+
<comment>Retrieves the height of an element</comment>
|
1250
|
+
|
1251
|
+
</function>
|
1252
|
+
|
1253
|
+
<function name="getCursorPosition">
|
1254
|
+
|
1255
|
+
<return type="number">the numerical position of the cursor in the field</return>
|
1256
|
+
|
1257
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an input element or textarea</param>
|
1258
|
+
|
1259
|
+
<comment>Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.
|
1260
|
+
|
1261
|
+
<p>Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
|
1262
|
+
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>
|
1263
|
+
This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.</comment>
|
1264
|
+
|
1265
|
+
</function>
|
1266
|
+
|
1267
|
+
<function name="getExpression">
|
1268
|
+
|
1269
|
+
<return type="string">the value passed in</return>
|
1270
|
+
|
1271
|
+
<param name="expression">the value to return</param>
|
1272
|
+
|
1273
|
+
<comment>Returns the specified expression.
|
1274
|
+
|
1275
|
+
<p>This is useful because of JavaScript preprocessing.
|
1276
|
+
It is used to generate commands like assertExpression and waitForExpression.</p></comment>
|
1277
|
+
|
1278
|
+
</function>
|
1279
|
+
|
1280
|
+
<function name="getXpathCount">
|
1281
|
+
|
1282
|
+
<return type="number">the number of nodes that match the specified xpath</return>
|
1283
|
+
|
1284
|
+
<param name="xpath">the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.</param>
|
1285
|
+
|
1286
|
+
<comment>Returns the number of nodes that match the specified xpath, eg. "//table" would give
|
1287
|
+
the number of tables.</comment>
|
1288
|
+
|
1289
|
+
</function>
|
1290
|
+
|
1291
|
+
<function name="assignId">
|
1292
|
+
|
1293
|
+
<param name="locator">an <a href="#locators">element locator</a> pointing to an element</param>
|
1294
|
+
|
1295
|
+
<param name="identifier">a string to be used as the ID of the specified element</param>
|
1296
|
+
|
1297
|
+
<comment>Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
|
1298
|
+
using its ID rather than a slow/complicated XPath. This ID will disappear once the page is
|
1299
|
+
reloaded.</comment>
|
1300
|
+
|
1301
|
+
</function>
|
1302
|
+
|
1303
|
+
<function name="allowNativeXpath">
|
1304
|
+
|
1305
|
+
<param name="allow">boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath</param>
|
1306
|
+
|
1307
|
+
<comment>Specifies whether Selenium should use the native in-browser implementation
|
1308
|
+
of XPath (if any native version is available); if you pass "false" to
|
1309
|
+
this function, we will always use our pure-JavaScript xpath library.
|
1310
|
+
Using the pure-JS xpath library can improve the consistency of xpath
|
1311
|
+
element locators between different browser vendors, but the pure-JS
|
1312
|
+
version is much slower than the native implementations.</comment>
|
1313
|
+
|
1314
|
+
</function>
|
1315
|
+
|
1316
|
+
<function name="waitForCondition">
|
1317
|
+
|
1318
|
+
<param name="script">the JavaScript snippet to run</param>
|
1319
|
+
|
1320
|
+
<param name="timeout">a timeout in milliseconds, after which this command will return with an error</param>
|
1321
|
+
|
1322
|
+
<comment>Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
|
1323
|
+
The snippet may have multiple lines, but only the result of the last line
|
1324
|
+
will be considered.
|
1325
|
+
|
1326
|
+
<p>Note that, by default, the snippet will be run in the runner's test window, not in the window
|
1327
|
+
of your application. To get the window of your application, you can use
|
1328
|
+
the JavaScript snippet <code>selenium.browserbot.getCurrentWindow()</code>, and then
|
1329
|
+
run your JavaScript in there</p></comment>
|
1330
|
+
|
1331
|
+
</function>
|
1332
|
+
|
1333
|
+
<function name="setTimeout">
|
1334
|
+
|
1335
|
+
<param name="timeout">a timeout in milliseconds, after which the action will return with an error</param>
|
1336
|
+
|
1337
|
+
<comment>Specifies the amount of time that Selenium will wait for actions to complete.
|
1338
|
+
|
1339
|
+
<p>Actions that require waiting include "open" and the "waitFor*" actions.</p>
|
1340
|
+
The default timeout is 30 seconds.</comment>
|
1341
|
+
|
1342
|
+
</function>
|
1343
|
+
|
1344
|
+
<function name="waitForPageToLoad">
|
1345
|
+
|
1346
|
+
<param name="timeout">a timeout in milliseconds, after which this command will return with an error</param>
|
1347
|
+
|
1348
|
+
<comment>Waits for a new page to load.
|
1349
|
+
|
1350
|
+
<p>You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
|
1351
|
+
(which are only available in the JS API).</p>
|
1352
|
+
|
1353
|
+
<p>Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
|
1354
|
+
flag when it first notices a page load. Running any other Selenium command after
|
1355
|
+
turns the flag to false. Hence, if you want to wait for a page to load, you must
|
1356
|
+
wait immediately after a Selenium command that caused a page-load.</p></comment>
|
1357
|
+
|
1358
|
+
</function>
|
1359
|
+
|
1360
|
+
<function name="waitForFrameToLoad">
|
1361
|
+
|
1362
|
+
<param name="frameAddress">FrameAddress from the server side</param>
|
1363
|
+
|
1364
|
+
<param name="timeout">a timeout in milliseconds, after which this command will return with an error</param>
|
1365
|
+
|
1366
|
+
<comment>Waits for a new frame to load.
|
1367
|
+
|
1368
|
+
<p>Selenium constantly keeps track of new pages and frames loading,
|
1369
|
+
and sets a "newPageLoaded" flag when it first notices a page load.</p>
|
1370
|
+
|
1371
|
+
See waitForPageToLoad for more information.</comment>
|
1372
|
+
|
1373
|
+
</function>
|
1374
|
+
|
1375
|
+
<function name="getCookie">
|
1376
|
+
|
1377
|
+
<return type="string">all cookies of the current page under test</return>
|
1378
|
+
|
1379
|
+
<comment>Return all cookies of the current page under test.</comment>
|
1380
|
+
|
1381
|
+
</function>
|
1382
|
+
|
1383
|
+
<function name="createCookie">
|
1384
|
+
|
1385
|
+
<param name="nameValuePair">name and value of the cookie in a format "name=value"</param>
|
1386
|
+
|
1387
|
+
<param name="optionsString">options for the cookie. Currently supported options include 'path' and 'max_age'. the optionsString's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit of the value of 'max_age' is second.</param>
|
1388
|
+
|
1389
|
+
<comment>Create a new cookie whose path and domain are same with those of current page
|
1390
|
+
under test, unless you specified a path for this cookie explicitly.</comment>
|
1391
|
+
|
1392
|
+
</function>
|
1393
|
+
|
1394
|
+
<function name="deleteCookie">
|
1395
|
+
|
1396
|
+
<param name="name">the name of the cookie to be deleted</param>
|
1397
|
+
|
1398
|
+
<param name="path">the path property of the cookie to be deleted</param>
|
1399
|
+
|
1400
|
+
<comment>Delete a named cookie with specified path.</comment>
|
1401
|
+
|
1402
|
+
</function>
|
1403
|
+
|
1404
|
+
<function name="setBrowserLogLevel">
|
1405
|
+
|
1406
|
+
<param name="logLevel">one of the following: "debug", "info", "warn", "error" or "off"</param>
|
1407
|
+
|
1408
|
+
<comment>Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
|
1409
|
+
Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
|
1410
|
+
To see the browser logs, you need to
|
1411
|
+
either show the log window in GUI mode, or enable browser-side logging in Selenium RC.</comment>
|
1412
|
+
|
1413
|
+
</function>
|
1414
|
+
|
1415
|
+
<function name="runScript">
|
1416
|
+
|
1417
|
+
<param name="script">the JavaScript snippet to run</param>
|
1418
|
+
|
1419
|
+
<comment>Creates a new "script" tag in the body of the current test window, and
|
1420
|
+
adds the specified text into the body of the command. Scripts run in
|
1421
|
+
this way can often be debugged more easily than scripts executed using
|
1422
|
+
Selenium's "getEval" command. Beware that JS exceptions thrown in these script
|
1423
|
+
tags aren't managed by Selenium, so you should probably wrap your script
|
1424
|
+
in try/catch blocks if there is any chance that the script will throw
|
1425
|
+
an exception.</comment>
|
1426
|
+
|
1427
|
+
</function>
|
1428
|
+
|
1429
|
+
<function name="addLocationStrategy">
|
1430
|
+
|
1431
|
+
<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>
|
1432
|
+
|
1433
|
+
<param name="functionDefinition">a string defining the body of a function in JavaScript. For example: <code>return inDocument.getElementById(locator);</code></param>
|
1434
|
+
|
1435
|
+
<comment>Defines a new function for Selenium to locate elements on the page.
|
1436
|
+
For example,
|
1437
|
+
if you define the strategy "foo", and someone runs click("foo=blah"), we'll
|
1438
|
+
run your function, passing you the string "blah", and click on the element
|
1439
|
+
that your function
|
1440
|
+
returns, or throw an "Element not found" error if your function returns null.
|
1441
|
+
|
1442
|
+
We'll pass three arguments to your function:
|
1443
|
+
<ul>
|
1444
|
+
<li>locator: the string the user passed in</li>
|
1445
|
+
<li>inWindow: the currently selected window</li>
|
1446
|
+
<li>inDocument: the currently selected document</li>
|
1447
|
+
</ul>
|
1448
|
+
The function must return null if the element can't be found.</comment>
|
1449
|
+
|
1450
|
+
</function>
|
1451
|
+
|
1452
|
+
<function name="pause">
|
1453
|
+
|
1454
|
+
<param name="waitTime">the amount of time to sleep (in milliseconds)</param>
|
1455
|
+
|
1456
|
+
<comment>Wait for the specified amount of time (in milliseconds)</comment>
|
1457
|
+
|
1458
|
+
</function>
|
1459
|
+
|
1460
|
+
<function name="break">
|
1461
|
+
|
1462
|
+
<comment>Halt the currently running test, and wait for the user to press the Continue button.
|
1463
|
+
This command is useful for debugging, but be careful when using it, because it will
|
1464
|
+
force automated tests to hang until a user intervenes manually.</comment>
|
1465
|
+
|
1466
|
+
</function>
|
1467
|
+
|
1468
|
+
<function name="store">
|
1469
|
+
|
1470
|
+
<param name="expression">the value to store</param>
|
1471
|
+
|
1472
|
+
<param name="variableName">the name of a <a href="#storedVars">variable</a> in which the result is to be stored.</param>
|
1473
|
+
|
1474
|
+
<comment>This command is a synonym for storeExpression.</comment>
|
1475
|
+
|
1476
|
+
</function>
|
1477
|
+
|
1478
|
+
<function name="echo">
|
1479
|
+
|
1480
|
+
<param name="message">the message to print</param>
|
1481
|
+
|
1482
|
+
<comment>Prints the specified message into the third table cell in your Selenese tables.
|
1483
|
+
Useful for debugging.</comment>
|
1484
|
+
|
1485
|
+
</function>
|
1486
|
+
|
1487
|
+
<function name="assertSelected">
|
1488
|
+
|
1489
|
+
<param name="selectLocator">an <a href="#locators">element locator</a> identifying a drop-down menu</param>
|
1490
|
+
|
1491
|
+
<param name="optionLocator">an option locator, typically just an option label (e.g. "John Smith")</param>
|
1492
|
+
|
1493
|
+
<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>
|
1494
|
+
|
1495
|
+
<p>See the select command for more information about option locators.</p></comment>
|
1496
|
+
|
1497
|
+
</function>
|
1498
|
+
|
1499
|
+
<function name="assertFailureOnNext">
|
1500
|
+
|
1501
|
+
<param name="message">The failure message we should expect. This command will fail if the wrong failure message appears.</param>
|
1502
|
+
|
1503
|
+
<comment>Tell Selenium to expect a failure on the next command execution.</comment>
|
1504
|
+
|
1505
|
+
</function>
|
1506
|
+
|
1507
|
+
<function name="assertErrorOnNext">
|
1508
|
+
|
1509
|
+
<param name="message">The error message we should expect. This command will fail if the wrong error message appears.</param>
|
1510
|
+
|
1511
|
+
<comment>Tell Selenium to expect an error on the next command execution.</comment>
|
1512
|
+
|
1513
|
+
</function>
|
1514
|
+
|
1515
|
+
</apidoc>
|