bauxite 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/Rakefile +69 -0
- data/bin/bauxite +27 -0
- data/doc/Bauxite/Action.html +1463 -0
- data/doc/Bauxite/ActionModule.html +342 -0
- data/doc/Bauxite/Context.html +1439 -0
- data/doc/Bauxite/Errors/AssertionError.html +107 -0
- data/doc/Bauxite/Errors/FileNotFoundError.html +107 -0
- data/doc/Bauxite/Errors.html +100 -0
- data/doc/Bauxite/Loggers/CompositeLogger.html +325 -0
- data/doc/Bauxite/Loggers/EchoLogger.html +164 -0
- data/doc/Bauxite/Loggers/FileLogger.html +215 -0
- data/doc/Bauxite/Loggers/NullLogger.html +334 -0
- data/doc/Bauxite/Loggers/TerminalLogger.html +586 -0
- data/doc/Bauxite/Loggers/XtermLogger.html +287 -0
- data/doc/Bauxite/Loggers.html +103 -0
- data/doc/Bauxite/Selector.html +422 -0
- data/doc/Bauxite/SelectorModule.html +283 -0
- data/doc/Bauxite.html +98 -0
- data/doc/created.rid +37 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/fonts.css +167 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +111 -0
- data/doc/js/darkfish.js +140 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +580 -0
- data/doc/table_of_contents.html +510 -0
- data/lib/bauxite/actions/alias.rb +51 -0
- data/lib/bauxite/actions/assert.rb +49 -0
- data/lib/bauxite/actions/assertv.rb +40 -0
- data/lib/bauxite/actions/break.rb +39 -0
- data/lib/bauxite/actions/click.rb +35 -0
- data/lib/bauxite/actions/debug.rb +99 -0
- data/lib/bauxite/actions/echo.rb +36 -0
- data/lib/bauxite/actions/exec.rb +46 -0
- data/lib/bauxite/actions/js.rb +41 -0
- data/lib/bauxite/actions/load.rb +49 -0
- data/lib/bauxite/actions/open.rb +34 -0
- data/lib/bauxite/actions/params.rb +40 -0
- data/lib/bauxite/actions/replace.rb +37 -0
- data/lib/bauxite/actions/reset.rb +37 -0
- data/lib/bauxite/actions/return.rb +62 -0
- data/lib/bauxite/actions/ruby.rb +58 -0
- data/lib/bauxite/actions/set.rb +39 -0
- data/lib/bauxite/actions/source.rb +44 -0
- data/lib/bauxite/actions/store.rb +38 -0
- data/lib/bauxite/actions/test.rb +61 -0
- data/lib/bauxite/actions/tryload.rb +79 -0
- data/lib/bauxite/actions/wait.rb +38 -0
- data/lib/bauxite/actions/write.rb +40 -0
- data/lib/bauxite/application.rb +150 -0
- data/lib/bauxite/core/Action.rb +205 -0
- data/lib/bauxite/core/Context.rb +575 -0
- data/lib/bauxite/core/Errors.rb +36 -0
- data/lib/bauxite/core/Logger.rb +86 -0
- data/lib/bauxite/core/Selector.rb +156 -0
- data/lib/bauxite/loggers/composite.rb +70 -0
- data/lib/bauxite/loggers/echo.rb +36 -0
- data/lib/bauxite/loggers/file.rb +45 -0
- data/lib/bauxite/loggers/terminal.rb +130 -0
- data/lib/bauxite/loggers/xterm.rb +79 -0
- data/lib/bauxite/selectors/attr.rb +39 -0
- data/lib/bauxite/selectors/default.rb +38 -0
- data/lib/bauxite/selectors/frame.rb +60 -0
- data/lib/bauxite.rb +29 -0
- data/test/alias.bxt +6 -0
- data/test/assertv.bxt +2 -0
- data/test/delay/page.html +5 -0
- data/test/delay.bxt +2 -0
- data/test/exec.bxt +6 -0
- data/test/format/page.html +7 -0
- data/test/format.bxt +17 -0
- data/test/frame/child_frame.html +7 -0
- data/test/frame/grandchild_frame.html +5 -0
- data/test/frame/page.html +5 -0
- data/test/frame.bxt +6 -0
- data/test/js.bxt +5 -0
- data/test/load/child.bxt +13 -0
- data/test/load.bxt +17 -0
- data/test/ruby/custom.rb +5 -0
- data/test/ruby.bxt +2 -0
- data/test/selectors/page.html +7 -0
- data/test/selectors.bxt +7 -0
- data/test/stdin.bxt +1 -0
- data/test/test/test1.bxt +2 -0
- data/test/test/test2.bxt +3 -0
- data/test/test/test3.bxt +2 -0
- data/test/test.bxt.manual +4 -0
- metadata +194 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>class Bauxite::Selector - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<link href="../fonts.css" rel="stylesheet">
|
|
10
|
+
<link href="../rdoc.css" rel="stylesheet">
|
|
11
|
+
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
var rdoc_rel_prefix = "../";
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<script src="../js/jquery.js"></script>
|
|
17
|
+
<script src="../js/navigation.js"></script>
|
|
18
|
+
<script src="../js/search_index.js"></script>
|
|
19
|
+
<script src="../js/search.js"></script>
|
|
20
|
+
<script src="../js/searcher.js"></script>
|
|
21
|
+
<script src="../js/darkfish.js"></script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<body id="top" role="document" class="class">
|
|
25
|
+
<nav role="navigation">
|
|
26
|
+
<div id="project-navigation">
|
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
28
|
+
<h2>
|
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
|
30
|
+
</h2>
|
|
31
|
+
|
|
32
|
+
<div id="table-of-contents-navigation">
|
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
41
|
+
<div id="search-field-wrapper">
|
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
|
49
|
+
aria-busy="false" aria-expanded="false"
|
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
51
|
+
</form>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<div id="class-metadata">
|
|
59
|
+
<div id="sections-section" class="nav-section">
|
|
60
|
+
<h3>Sections</h3>
|
|
61
|
+
|
|
62
|
+
<ul class="link-list" role="directory">
|
|
63
|
+
|
|
64
|
+
<li><a href="#5Buntitled-5D"></a></li>
|
|
65
|
+
|
|
66
|
+
<li><a href="#Selector+Methods">Selector Methods</a></li>
|
|
67
|
+
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div id="parent-class-section" class="nav-section">
|
|
72
|
+
<h3>Parent</h3>
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
<p class="link">Object
|
|
76
|
+
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div id="includes-section" class="nav-section">
|
|
80
|
+
<h3>Included Modules</h3>
|
|
81
|
+
|
|
82
|
+
<ul class="link-list">
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<li><span class="include">SelectorModule</span>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
</ul>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
<!-- Method Quickref -->
|
|
93
|
+
<div id="method-list-section" class="nav-section">
|
|
94
|
+
<h3>Methods</h3>
|
|
95
|
+
|
|
96
|
+
<ul class="link-list" role="directory">
|
|
97
|
+
|
|
98
|
+
<li ><a href="#method-i-attr">#attr</a>
|
|
99
|
+
|
|
100
|
+
<li ><a href="#method-i-default">#default</a>
|
|
101
|
+
|
|
102
|
+
<li ><a href="#method-i-frame">#frame</a>
|
|
103
|
+
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
</nav>
|
|
109
|
+
|
|
110
|
+
<main role="main" aria-labelledby="class-Bauxite::Selector">
|
|
111
|
+
<h1 id="class-Bauxite::Selector" class="class">
|
|
112
|
+
class Bauxite::Selector
|
|
113
|
+
</h1>
|
|
114
|
+
|
|
115
|
+
<section class="description">
|
|
116
|
+
|
|
117
|
+
<p><a href="Selector.html">Selector</a> class.</p>
|
|
118
|
+
|
|
119
|
+
<p>Selectors represent different strategies for finding elements. Selenium
|
|
120
|
+
provides a list of standard selectors (e.g. by id, by css expression, etc).</p>
|
|
121
|
+
|
|
122
|
+
<p>Additional selectors can be specified by defining custom methods in the <a
|
|
123
|
+
href="Selector.html">Selector</a> class.</p>
|
|
124
|
+
|
|
125
|
+
<p>Each custom selector is defined in a separate file in the
|
|
126
|
+
'selectors/' directory. The name of the file must match the name of
|
|
127
|
+
the selector. These files should avoid adding public methods other than the
|
|
128
|
+
selector method itself. Also, no <code>attr_accessors</code> should be
|
|
129
|
+
added.</p>
|
|
130
|
+
|
|
131
|
+
<p><a href="Selector.html">Selector</a> methods can use the <code>ctx</code>
|
|
132
|
+
attribute to refer to the current test Context. The protected method
|
|
133
|
+
selenium_find can also be used to locate elements using standard Selenium
|
|
134
|
+
selectors.</p>
|
|
135
|
+
|
|
136
|
+
<p><a href="Selector.html">Selector</a> methods should always take a block and
|
|
137
|
+
forward that block to a call to either find or selenium_find.</p>
|
|
138
|
+
|
|
139
|
+
<p>For example (new selector template):</p>
|
|
140
|
+
|
|
141
|
+
<pre class="ruby"><span class="ruby-comment"># === selectors/data.rb ======= #</span>
|
|
142
|
+
<span class="ruby-keyword">class</span> <span class="ruby-constant">Selector</span>
|
|
143
|
+
<span class="ruby-comment"># :category: Selector Methods</span>
|
|
144
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">data</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
145
|
+
<span class="ruby-comment"># selector code goes here, for example:</span>
|
|
146
|
+
<span class="ruby-identifier">selenium_find</span>(:<span class="ruby-identifier">css</span>, <span class="ruby-node">"[data='#{arg}']"</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
147
|
+
<span class="ruby-keyword">end</span>
|
|
148
|
+
<span class="ruby-keyword">end</span>
|
|
149
|
+
<span class="ruby-comment"># === end selectors/data.rb === #</span>
|
|
150
|
+
|
|
151
|
+
<span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">selectors</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'data'</span> <span class="ruby-comment"># => true</span>
|
|
152
|
+
</pre>
|
|
153
|
+
|
|
154
|
+
<p>To avoid name clashing with Ruby reserved words, the '_selector'
|
|
155
|
+
suffix can be included in the selector method name (this suffix will not be
|
|
156
|
+
considered part of the selector name).</p>
|
|
157
|
+
|
|
158
|
+
<p>For example (_selector suffix):</p>
|
|
159
|
+
|
|
160
|
+
<pre class="ruby"><span class="ruby-comment"># === selectors/end.rb ======= #</span>
|
|
161
|
+
<span class="ruby-keyword">class</span> <span class="ruby-constant">Selector</span>
|
|
162
|
+
<span class="ruby-comment"># :category: Selector Methods</span>
|
|
163
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">end_selector</span>
|
|
164
|
+
<span class="ruby-comment"># do something</span>
|
|
165
|
+
<span class="ruby-keyword">end</span>
|
|
166
|
+
<span class="ruby-keyword">end</span>
|
|
167
|
+
<span class="ruby-comment"># === end selector/end.rb === #</span>
|
|
168
|
+
|
|
169
|
+
<span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">selectors</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'end'</span> <span class="ruby-comment"># => true</span>
|
|
170
|
+
</pre>
|
|
171
|
+
<hr>
|
|
172
|
+
|
|
173
|
+
<h3 id="class-Bauxite::Selector-label-Standard+Selenium+Selectors">Standard Selenium Selectors<span><a href="#class-Bauxite::Selector-label-Standard+Selenium+Selectors">¶</a> <a href="#documentation">↑</a></span></h3>
|
|
174
|
+
<dl class="rdoc-list label-list"><dt>id=<code>targetValue</code>
|
|
175
|
+
<dd>
|
|
176
|
+
<p><a href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-id">Locate
|
|
177
|
+
elements whose id attribute matches targetValue.</a></p>
|
|
178
|
+
</dd><dt>name=<code>targetValue</code>
|
|
179
|
+
<dd>
|
|
180
|
+
<p><a href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-name">Locate
|
|
181
|
+
elements whose name attribute matches targetValue.</a></p>
|
|
182
|
+
</dd><dt>css=<code>cssSelectorSyntax</code>
|
|
183
|
+
<dd>
|
|
184
|
+
<p><a href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-css">Locate
|
|
185
|
+
elements using CSS selector syntax.</a></p>
|
|
186
|
+
</dd><dt>partial_link_text=<code>textFragment</code>
|
|
187
|
+
<dd>
|
|
188
|
+
<p><a
|
|
189
|
+
href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-partial-link-text">Locate
|
|
190
|
+
A elements whose text includes textFragment.</a></p>
|
|
191
|
+
</dd><dt>class=<code>className</code> and class_name=<code>className</code>
|
|
192
|
+
<dd>
|
|
193
|
+
<p><a
|
|
194
|
+
href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-class-name">Locate
|
|
195
|
+
elements whose class attribute matches className.</a></p>
|
|
196
|
+
</dd><dt>link=<code>exactText</code> and link_text=<code>exactText</code>
|
|
197
|
+
<dd>
|
|
198
|
+
<p><a
|
|
199
|
+
href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-link-text">Locate
|
|
200
|
+
A elements whose text is exactly exactText.</a></p>
|
|
201
|
+
</dd><dt>tag_name=<code>targetValue</code>
|
|
202
|
+
<dd>
|
|
203
|
+
<p><a
|
|
204
|
+
href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-tag-name">Locate
|
|
205
|
+
elements whose tag name matches targetValue.</a></p>
|
|
206
|
+
</dd><dt>xpath=<code>xpathExpression</code>
|
|
207
|
+
<dd>
|
|
208
|
+
<p><a href="http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-xpath">Locate
|
|
209
|
+
elements using XPATH expressions.</a></p>
|
|
210
|
+
</dd></dl>
|
|
211
|
+
|
|
212
|
+
</section>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
</section>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<section id="Selector+Methods" class="documentation-section">
|
|
232
|
+
|
|
233
|
+
<header class="documentation-section-title">
|
|
234
|
+
<h2>
|
|
235
|
+
Selector Methods
|
|
236
|
+
</h2>
|
|
237
|
+
<span class="section-click-top">
|
|
238
|
+
<a href="#top">↑ top</a>
|
|
239
|
+
</span>
|
|
240
|
+
</header>
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
<section id="public-instance-Selector+Methods-method-details" class="method-section">
|
|
251
|
+
<header>
|
|
252
|
+
<h3>Public Instance Methods</h3>
|
|
253
|
+
</header>
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
<div id="method-i-attr" class="method-detail ">
|
|
257
|
+
|
|
258
|
+
<div class="method-heading">
|
|
259
|
+
<span class="method-name">attr</span><span
|
|
260
|
+
class="method-args">(arg, &block)</span>
|
|
261
|
+
|
|
262
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
263
|
+
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
<div class="method-description">
|
|
268
|
+
|
|
269
|
+
<p>Select an element by attribute value.</p>
|
|
270
|
+
|
|
271
|
+
<p>The attribute selector syntax is:</p>
|
|
272
|
+
|
|
273
|
+
<pre>attr=name:value</pre>
|
|
274
|
+
|
|
275
|
+
<p>For example:</p>
|
|
276
|
+
|
|
277
|
+
<pre class="ruby"><span class="ruby-comment"># assuming <div custom="true">foo</div></span>
|
|
278
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-identifier">attr</span>=<span class="ruby-identifier">custom</span>:<span class="ruby-keyword">true</span> <span class="ruby-string">"foo"</span>
|
|
279
|
+
<span class="ruby-comment"># => matches the element above.</span>
|
|
280
|
+
</pre>
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<div class="method-source-code" id="attr-source">
|
|
286
|
+
<pre><span class="ruby-comment"># File lib/bauxite/selectors/attr.rb, line 35</span>
|
|
287
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">attr</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
288
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>, <span class="ruby-value">2</span>)
|
|
289
|
+
<span class="ruby-identifier">selenium_find</span>(<span class="ruby-value">:css</span>, <span class="ruby-node">"[#{data[0]}='#{data[1]}']"</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
290
|
+
<span class="ruby-keyword">end</span></pre>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
<div id="method-i-default" class="method-detail ">
|
|
302
|
+
|
|
303
|
+
<div class="method-heading">
|
|
304
|
+
<span class="method-name">default</span><span
|
|
305
|
+
class="method-args">(arg, &block)</span>
|
|
306
|
+
|
|
307
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
308
|
+
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<div class="method-description">
|
|
313
|
+
|
|
314
|
+
<p>Select an element by id suffix.</p>
|
|
315
|
+
|
|
316
|
+
<p>This is the default selector. Any selector strings that do not contain an
|
|
317
|
+
equal sign (i.e. '=') will use this selector.</p>
|
|
318
|
+
|
|
319
|
+
<p>For example:</p>
|
|
320
|
+
|
|
321
|
+
<pre class="ruby"><span class="ruby-comment"># assuming <div id="strange_uuid_like_stuff_myDiv">foo</div></span>
|
|
322
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-identifier">myDiv</span> <span class="ruby-string">"foo"</span>
|
|
323
|
+
<span class="ruby-comment"># => matches the element above.</span>
|
|
324
|
+
</pre>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<div class="method-source-code" id="default-source">
|
|
330
|
+
<pre><span class="ruby-comment"># File lib/bauxite/selectors/default.rb, line 35</span>
|
|
331
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
332
|
+
<span class="ruby-identifier">selenium_find</span>(<span class="ruby-value">:css</span>, <span class="ruby-node">"[id$='#{arg.gsub("'", "\\'")}']"</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
333
|
+
<span class="ruby-keyword">end</span></pre>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
<div id="method-i-frame" class="method-detail ">
|
|
345
|
+
|
|
346
|
+
<div class="method-heading">
|
|
347
|
+
<span class="method-name">frame</span><span
|
|
348
|
+
class="method-args">(arg, &block)</span>
|
|
349
|
+
|
|
350
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
351
|
+
|
|
352
|
+
</div>
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
<div class="method-description">
|
|
356
|
+
|
|
357
|
+
<p>Change the selector scope to the given frame and finds an element in that
|
|
358
|
+
frame.</p>
|
|
359
|
+
|
|
360
|
+
<p>This is a composite selector. The frame selector syntax is:</p>
|
|
361
|
+
|
|
362
|
+
<pre>frame=|frame_selector|child_selector</pre>
|
|
363
|
+
|
|
364
|
+
<p>Where <code>frame_selector</code> is any selector available that matches
|
|
365
|
+
the target frame, <code>child_selector</code> is any selector available
|
|
366
|
+
that matches the target element inside the target frame.</p>
|
|
367
|
+
|
|
368
|
+
<p>Note that the '|' character can be replaced with any
|
|
369
|
+
single-character delimiter.</p>
|
|
370
|
+
|
|
371
|
+
<p>Also note that frame selectors can be embedded to select a frame inside a
|
|
372
|
+
frame. To accompilish this, <code>child_selector</code> can be a frame
|
|
373
|
+
selector.</p>
|
|
374
|
+
|
|
375
|
+
<p>For example:</p>
|
|
376
|
+
|
|
377
|
+
<pre class="ruby"><span class="ruby-comment"># assuming <iframe class="myframe"></span>
|
|
378
|
+
<span class="ruby-comment"># <div id="child">foo</div></span>
|
|
379
|
+
<span class="ruby-comment"># </iframe></span>
|
|
380
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-string">"frame=|css=.myframe|child"</span> <span class="ruby-string">"foo"</span>
|
|
381
|
+
<span class="ruby-comment"># => matches the 'child' element above.</span>
|
|
382
|
+
</pre>
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
<div class="method-source-code" id="frame-source">
|
|
388
|
+
<pre><span class="ruby-comment"># File lib/bauxite/selectors/frame.rb, line 48</span>
|
|
389
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">frame</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
390
|
+
<span class="ruby-identifier">delimiter</span> = <span class="ruby-identifier">arg</span>[<span class="ruby-value">0</span>]
|
|
391
|
+
<span class="ruby-identifier">items</span> = <span class="ruby-identifier">arg</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">split</span>(<span class="ruby-identifier">delimiter</span>, <span class="ruby-value">2</span>)
|
|
392
|
+
<span class="ruby-identifier">frame</span> = <span class="ruby-identifier">find</span>(<span class="ruby-identifier">items</span>[<span class="ruby-value">0</span>])
|
|
393
|
+
|
|
394
|
+
<span class="ruby-keyword">begin</span>
|
|
395
|
+
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">switch_to</span>.<span class="ruby-identifier">frame</span> <span class="ruby-identifier">frame</span>
|
|
396
|
+
<span class="ruby-identifier">find</span>(<span class="ruby-identifier">items</span>[<span class="ruby-value">1</span>], <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
397
|
+
<span class="ruby-keyword">ensure</span>
|
|
398
|
+
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">switch_to</span>.<span class="ruby-identifier">default_content</span>
|
|
399
|
+
<span class="ruby-keyword">end</span>
|
|
400
|
+
<span class="ruby-keyword">end</span></pre>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
</section>
|
|
412
|
+
|
|
413
|
+
</section>
|
|
414
|
+
</main>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
<footer id="validator-badges" role="contentinfo">
|
|
418
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
419
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
420
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
421
|
+
</footer>
|
|
422
|
+
|