mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
1050 lines
44 KiB
HTML
1050 lines
44 KiB
HTML
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
|
<!DOCTYPE html
|
||
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
|
|
||
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
|
|
<head>
|
||
|
|
<title>Module: SeleniumOnRails::TestBuilderActions</title>
|
||
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||
|
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||
|
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
||
|
|
<script type="text/javascript">
|
||
|
|
// <![CDATA[
|
||
|
|
|
||
|
|
function popupCode( url ) {
|
||
|
|
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||
|
|
}
|
||
|
|
|
||
|
|
function toggleCode( id ) {
|
||
|
|
if ( document.getElementById )
|
||
|
|
elem = document.getElementById( id );
|
||
|
|
else if ( document.all )
|
||
|
|
elem = eval( "document.all." + id );
|
||
|
|
else
|
||
|
|
return false;
|
||
|
|
|
||
|
|
elemStyle = elem.style;
|
||
|
|
|
||
|
|
if ( elemStyle.display != "block" ) {
|
||
|
|
elemStyle.display = "block"
|
||
|
|
} else {
|
||
|
|
elemStyle.display = "none"
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Make codeblocks hidden by default
|
||
|
|
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||
|
|
|
||
|
|
// ]]>
|
||
|
|
</script>
|
||
|
|
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div id="classHeader">
|
||
|
|
<table class="header-table">
|
||
|
|
<tr class="top-aligned-row">
|
||
|
|
<td><strong>Module</strong></td>
|
||
|
|
<td class="class-name-in-header">SeleniumOnRails::TestBuilderActions</td>
|
||
|
|
</tr>
|
||
|
|
<tr class="top-aligned-row">
|
||
|
|
<td><strong>In:</strong></td>
|
||
|
|
<td>
|
||
|
|
<a href="../../files/lib/selenium_on_rails/test_builder_actions_rb.html">
|
||
|
|
lib/selenium_on_rails/test_builder_actions.rb
|
||
|
|
</a>
|
||
|
|
<br />
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<!-- banner header -->
|
||
|
|
|
||
|
|
<div id="bodyContent">
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div id="contextContent">
|
||
|
|
|
||
|
|
<div id="description">
|
||
|
|
<p>
|
||
|
|
The actions available for <a
|
||
|
|
href="TestBuilder.html">SeleniumOnRails::TestBuilder</a> tests.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
For each action <tt>foo</tt> there’s also an action
|
||
|
|
<tt>foo_and_wait</tt>.
|
||
|
|
</p>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-list">
|
||
|
|
<h3 class="section-bar">Methods</h3>
|
||
|
|
|
||
|
|
<div class="name-list">
|
||
|
|
<a href="#M000022">add_selection</a>
|
||
|
|
<a href="#M000029">answer_on_next_prompt</a>
|
||
|
|
<a href="#M000019">check</a>
|
||
|
|
<a href="#M000028">choose_cancel_on_next_confirmation</a>
|
||
|
|
<a href="#M000011">click</a>
|
||
|
|
<a href="#M000032">close</a>
|
||
|
|
<a href="#M000012">fire_event</a>
|
||
|
|
<a href="#M000030">go_back</a>
|
||
|
|
<a href="#M000010">include_partial</a>
|
||
|
|
<a href="#M000014">key_down</a>
|
||
|
|
<a href="#M000013">key_press</a>
|
||
|
|
<a href="#M000015">key_up</a>
|
||
|
|
<a href="#M000017">mouse_down</a>
|
||
|
|
<a href="#M000016">mouse_over</a>
|
||
|
|
<a href="#M000025">open</a>
|
||
|
|
<a href="#M000031">refresh</a>
|
||
|
|
<a href="#M000023">remove_selection</a>
|
||
|
|
<a href="#M000021">select</a>
|
||
|
|
<a href="#M000026">select_window</a>
|
||
|
|
<a href="#M000033">set_context</a>
|
||
|
|
<a href="#M000035">set_timeout</a>
|
||
|
|
<a href="#M000009">setup</a>
|
||
|
|
<a href="#M000024">submit</a>
|
||
|
|
<a href="#M000018">type</a>
|
||
|
|
<a href="#M000020">uncheck</a>
|
||
|
|
<a href="#M000034">wait_for_condition</a>
|
||
|
|
<a href="#M000036">wait_for_page_to_load</a>
|
||
|
|
<a href="#M000027">wait_for_popup</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- if includes -->
|
||
|
|
|
||
|
|
<div id="section">
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<!-- if method_list -->
|
||
|
|
<div id="methods">
|
||
|
|
<h3 class="section-bar">Public Instance methods</h3>
|
||
|
|
|
||
|
|
<div id="method-M000022" class="method-detail">
|
||
|
|
<a name="M000022"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000022" class="method-signature">
|
||
|
|
<span class="method-name">add_selection</span><span class="method-args">(locator, option_locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Add a selection to the set of selected options in a multi-select element
|
||
|
|
using an option locator.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
See the <tt><a href="TestBuilderActions.html#M000021">select</a></tt>
|
||
|
|
command for more information about option locators.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000022-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 142</span>
|
||
|
|
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_selection</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">option_locator</span>
|
||
|
|
143: <span class="ruby-identifier">command</span> <span class="ruby-value str">'addSelection'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">option_locator</span>
|
||
|
|
144: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000029" class="method-detail">
|
||
|
|
<a name="M000029"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000029" class="method-signature">
|
||
|
|
<span class="method-name">answer_on_next_prompt</span><span class="method-args">(answer)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Instructs Selenium to return the specified answer string in response to the
|
||
|
|
next JavaScript prompt (<tt>window.prompt()</tt>).
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000029-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 193</span>
|
||
|
|
193: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">answer_on_next_prompt</span> <span class="ruby-identifier">answer</span>
|
||
|
|
194: <span class="ruby-identifier">command</span> <span class="ruby-value str">'answerOnNextPrompt'</span>, <span class="ruby-identifier">answer</span>
|
||
|
|
195: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000019" class="method-detail">
|
||
|
|
<a name="M000019"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000019" class="method-signature">
|
||
|
|
<span class="method-name">check</span><span class="method-args">(locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Check a toggle-button (checkbox/radio).
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000019-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 102</span>
|
||
|
|
102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check</span> <span class="ruby-identifier">locator</span>
|
||
|
|
103: <span class="ruby-identifier">command</span> <span class="ruby-value str">'check'</span>, <span class="ruby-identifier">locator</span>
|
||
|
|
104: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000028" class="method-detail">
|
||
|
|
<a name="M000028"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000028" class="method-signature">
|
||
|
|
<span class="method-name">choose_cancel_on_next_confirmation</span><span class="method-args">()</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
By default, Selenium’s overridden <tt>window.confirm()</tt> function
|
||
|
|
will return <tt>true</tt>, as if the user had manually clicked OK. After
|
||
|
|
running this command, the next call to <tt>confirm()</tt> will return
|
||
|
|
<tt>false</tt>, as if the user had clicked Cancel.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000028-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 187</span>
|
||
|
|
187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">choose_cancel_on_next_confirmation</span>
|
||
|
|
188: <span class="ruby-identifier">command</span> <span class="ruby-value str">'chooseCancelOnNextConfirmation'</span>
|
||
|
|
189: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000011" class="method-detail">
|
||
|
|
<a name="M000011"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000011" class="method-signature">
|
||
|
|
<span class="method-name">click</span><span class="method-args">(locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Clicks on a link, button, checkbox or radio button. If the click action
|
||
|
|
causes a new page to load (like a link usually does), call <tt><a
|
||
|
|
href="TestBuilderActions.html#M000036">wait_for_page_to_load</a></tt>.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000011-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 47</span>
|
||
|
|
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">click</span> <span class="ruby-identifier">locator</span>
|
||
|
|
48: <span class="ruby-identifier">command</span> <span class="ruby-value str">'click'</span>, <span class="ruby-identifier">locator</span>
|
||
|
|
49: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000032" class="method-detail">
|
||
|
|
<a name="M000032"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000032" class="method-signature">
|
||
|
|
<span class="method-name">close</span><span class="method-args">()</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates the user clicking the "close" button in the titlebar of
|
||
|
|
a popup window or tab.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000032-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 209</span>
|
||
|
|
209: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
|
||
|
|
210: <span class="ruby-identifier">command</span> <span class="ruby-value str">'close'</span>
|
||
|
|
211: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000012" class="method-detail">
|
||
|
|
<a name="M000012"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000012" class="method-signature">
|
||
|
|
<span class="method-name">fire_event</span><span class="method-args">(locator, event_name)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Explicitly simulate an event (e.g. <tt>"focus"</tt>,
|
||
|
|
<tt>"blur"</tt>), to trigger the corresponding
|
||
|
|
<tt>"on_event_"</tt> handler.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000012-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 53</span>
|
||
|
|
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fire_event</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">event_name</span>
|
||
|
|
54: <span class="ruby-identifier">command</span> <span class="ruby-value str">'fireEvent'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">event_name</span>
|
||
|
|
55: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000030" class="method-detail">
|
||
|
|
<a name="M000030"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000030" class="method-signature">
|
||
|
|
<span class="method-name">go_back</span><span class="method-args">()</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates the user clicking the "back" button on their browser.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000030-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 198</span>
|
||
|
|
198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">go_back</span>
|
||
|
|
199: <span class="ruby-identifier">command</span> <span class="ruby-value str">'goBack'</span>
|
||
|
|
200: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000010" class="method-detail">
|
||
|
|
<a name="M000010"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000010" class="method-signature">
|
||
|
|
<span class="method-name">include_partial</span><span class="method-args">(path, local_assigns = {})</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Includes a partial. The path is relative to the Selenium tests root. The
|
||
|
|
starting _ and the file extension don’t have to be specified.
|
||
|
|
</p>
|
||
|
|
<pre>
|
||
|
|
#include test/selenium/_partial.*
|
||
|
|
include_partial 'partial'
|
||
|
|
#include test/selenium/suite/_partial.*
|
||
|
|
include_partial 'suite/partial'
|
||
|
|
#include test/selenium/suite/_partial.* and provide local assigns
|
||
|
|
include_partial 'suite/partial', :foo => bar
|
||
|
|
</pre>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000010-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 39</span>
|
||
|
|
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_partial</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">local_assigns</span> = {}
|
||
|
|
40: <span class="ruby-identifier">partial</span> = <span class="ruby-ivar">@view</span>.<span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">local_assigns</span>
|
||
|
|
41: <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">partial</span>
|
||
|
|
42: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000014" class="method-detail">
|
||
|
|
<a name="M000014"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000014" class="method-signature">
|
||
|
|
<span class="method-name">key_down</span><span class="method-args">(locator, keycode)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates a user pressing a key (without releasing it yet).
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>keycode</tt> is the numeric keycode of the key to be pressed, normally
|
||
|
|
the ASCII value of that key.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000014-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 69</span>
|
||
|
|
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key_down</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">keycode</span>
|
||
|
|
70: <span class="ruby-identifier">command</span> <span class="ruby-value str">'keyDown'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">keycode</span>
|
||
|
|
71: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000013" class="method-detail">
|
||
|
|
<a name="M000013"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000013" class="method-signature">
|
||
|
|
<span class="method-name">key_press</span><span class="method-args">(locator, keycode)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates a user pressing and releasing a key.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>keycode</tt> is the numeric keycode of the key to be pressed, normally
|
||
|
|
the ASCII value of that key.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000013-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 61</span>
|
||
|
|
61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key_press</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">keycode</span>
|
||
|
|
62: <span class="ruby-identifier">command</span> <span class="ruby-value str">'keyPress'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">keycode</span>
|
||
|
|
63: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000015" class="method-detail">
|
||
|
|
<a name="M000015"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000015" class="method-signature">
|
||
|
|
<span class="method-name">key_up</span><span class="method-args">(locator, keycode)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates a user releasing a key.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>keycode</tt> is the numeric keycode of the key to be released, normally
|
||
|
|
the ASCII value of that key.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000015-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 77</span>
|
||
|
|
77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key_up</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">keycode</span>
|
||
|
|
78: <span class="ruby-identifier">command</span> <span class="ruby-value str">'keyUp'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">keycode</span>
|
||
|
|
79: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000017" class="method-detail">
|
||
|
|
<a name="M000017"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000017" class="method-signature">
|
||
|
|
<span class="method-name">mouse_down</span><span class="method-args">(locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates a user pressing the mouse button (without releasing it yet) on
|
||
|
|
the specified element.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000017-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 88</span>
|
||
|
|
88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mouse_down</span> <span class="ruby-identifier">locator</span>
|
||
|
|
89: <span class="ruby-identifier">command</span> <span class="ruby-value str">'mouseDown'</span>, <span class="ruby-identifier">locator</span>
|
||
|
|
90: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000016" class="method-detail">
|
||
|
|
<a name="M000016"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000016" class="method-signature">
|
||
|
|
<span class="method-name">mouse_over</span><span class="method-args">(locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates a user hovering a mouse over the specified element.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000016-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 82</span>
|
||
|
|
82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mouse_over</span> <span class="ruby-identifier">locator</span>
|
||
|
|
83: <span class="ruby-identifier">command</span> <span class="ruby-value str">'mouseOver'</span>, <span class="ruby-identifier">locator</span>
|
||
|
|
84: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000025" class="method-detail">
|
||
|
|
<a name="M000025"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000025" class="method-signature">
|
||
|
|
<span class="method-name">open</span><span class="method-args">(url)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Opens an URL in the test frame. This accepts both relative and absolute
|
||
|
|
URLs. The <tt>open</tt> command waits for the page to load before
|
||
|
|
proceeding, i.e. you don’t have to call <tt><a
|
||
|
|
href="TestBuilderActions.html#M000036">wait_for_page_to_load</a></tt>.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Note: The URL must be on the same domain as the runner HTML due to security
|
||
|
|
restrictions in the browser (Same Origin Policy).
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000025-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 166</span>
|
||
|
|
166: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open</span> <span class="ruby-identifier">url</span>
|
||
|
|
167: <span class="ruby-identifier">command</span> <span class="ruby-value str">'open'</span>, <span class="ruby-identifier">url_arg</span>(<span class="ruby-identifier">url</span>)
|
||
|
|
168: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000031" class="method-detail">
|
||
|
|
<a name="M000031"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000031" class="method-signature">
|
||
|
|
<span class="method-name">refresh</span><span class="method-args">()</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Simulates the user clicking the "Refresh" button on their
|
||
|
|
browser.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000031-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 203</span>
|
||
|
|
203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">refresh</span>
|
||
|
|
204: <span class="ruby-identifier">command</span> <span class="ruby-value str">'refresh'</span>
|
||
|
|
205: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000023" class="method-detail">
|
||
|
|
<a name="M000023"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000023" class="method-signature">
|
||
|
|
<span class="method-name">remove_selection</span><span class="method-args">(locator, option_locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Remove a selection from the set of selected options in a multi-select
|
||
|
|
element using an option locator.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
See the <tt>select</tt> command for more information about option locators.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000023-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 150</span>
|
||
|
|
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_selection</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">option_locator</span>
|
||
|
|
151: <span class="ruby-identifier">command</span> <span class="ruby-value str">'removeSelection'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">option_locator</span>
|
||
|
|
152: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000021" class="method-detail">
|
||
|
|
<a name="M000021"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000021" class="method-signature">
|
||
|
|
<span class="method-name">select</span><span class="method-args">(locator, option_locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Select an option from a drop-down using an option locator.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Option locators provide different ways of specifying options of an HTML
|
||
|
|
Select element (e.g. for selecting a specific option, or for asserting that
|
||
|
|
the selected option satisfies a specification). There are several forms of
|
||
|
|
Select Option Locator.
|
||
|
|
</p>
|
||
|
|
<ul>
|
||
|
|
<li>label=labelPattern matches options based on their labels, i.e. the visible
|
||
|
|
text. (This is the default.)
|
||
|
|
|
||
|
|
<pre>
|
||
|
|
label=regexp:^[Oo]ther
|
||
|
|
</pre>
|
||
|
|
</li>
|
||
|
|
<li>value=valuePattern matches options based on their values.
|
||
|
|
|
||
|
|
<pre>
|
||
|
|
value=other
|
||
|
|
</pre>
|
||
|
|
</li>
|
||
|
|
<li>id=id matches options based on their ids.
|
||
|
|
|
||
|
|
<pre>
|
||
|
|
id=option1
|
||
|
|
</pre>
|
||
|
|
</li>
|
||
|
|
<li>index=index matches an option based on its index (offset from zero).
|
||
|
|
|
||
|
|
<pre>
|
||
|
|
index=2
|
||
|
|
</pre>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
<p>
|
||
|
|
If no option locator prefix is provided, the default behaviour is to match
|
||
|
|
on label.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000021-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 134</span>
|
||
|
|
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">option_locator</span>
|
||
|
|
135: <span class="ruby-identifier">command</span> <span class="ruby-value str">'select'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">option_locator</span>
|
||
|
|
136: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000026" class="method-detail">
|
||
|
|
<a name="M000026"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000026" class="method-signature">
|
||
|
|
<span class="method-name">select_window</span><span class="method-args">(window_id)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Selects a popup window; once a popup window has been selected, all commands
|
||
|
|
go to that window. To select the main window again, use <tt>nil</tt> as the
|
||
|
|
target.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000026-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 172</span>
|
||
|
|
172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select_window</span> <span class="ruby-identifier">window_id</span>
|
||
|
|
173: <span class="ruby-identifier">command</span> <span class="ruby-value str">'selectWindow'</span>, <span class="ruby-identifier">window_id</span><span class="ruby-operator">||</span><span class="ruby-value str">'null'</span>
|
||
|
|
174: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000033" class="method-detail">
|
||
|
|
<a name="M000033"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000033" class="method-signature">
|
||
|
|
<span class="method-name">set_context</span><span class="method-args">(context, log_level_threshold = nil)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Writes a message to the status bar and adds a note to the browser-side log.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>context</tt> is the message sent to the browser.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>log_level_threshold</tt> can be <tt>nil</tt>, <tt>:debug</tt>,
|
||
|
|
<tt>:info</tt>, <tt>:warn</tt> or <tt>:error</tt>.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000033-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 219</span>
|
||
|
|
219: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_context</span> <span class="ruby-identifier">context</span>, <span class="ruby-identifier">log_level_threshold</span> = <span class="ruby-keyword kw">nil</span>
|
||
|
|
220: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">log_level_threshold</span>
|
||
|
|
221: <span class="ruby-identifier">command</span> <span class="ruby-value str">'setContext'</span>, <span class="ruby-identifier">context</span>, <span class="ruby-identifier">log_level_threshold</span>.<span class="ruby-identifier">to_s</span>
|
||
|
|
222: <span class="ruby-keyword kw">else</span>
|
||
|
|
223: <span class="ruby-identifier">command</span> <span class="ruby-value str">'setContext'</span>, <span class="ruby-identifier">context</span>
|
||
|
|
224: <span class="ruby-keyword kw">end</span>
|
||
|
|
225: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000035" class="method-detail">
|
||
|
|
<a name="M000035"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000035" class="method-signature">
|
||
|
|
<span class="method-name">set_timeout</span><span class="method-args">(timeout)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Specifies the amount of time that Selenium will wait for actions to
|
||
|
|
complete.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Actions that require waiting include <tt>open</tt> and the
|
||
|
|
<tt>wait_for*</tt> actions.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
The default timeout is 30 seconds.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>timeout</tt> is specified in milliseconds.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000035-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 251</span>
|
||
|
|
251: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_timeout</span> <span class="ruby-identifier">timeout</span>
|
||
|
|
252: <span class="ruby-identifier">command</span> <span class="ruby-value str">'setTimeout'</span>, <span class="ruby-identifier">timeout</span>
|
||
|
|
253: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000009" class="method-detail">
|
||
|
|
<a name="M000009"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000009" class="method-signature">
|
||
|
|
<span class="method-name">setup</span><span class="method-args">(options = {})</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Tell Selenium on Rails to clear the session and load any fixtures. DO NOT
|
||
|
|
CALL THIS AGAINST NON-TEST DATABASES. The supported <tt>options</tt> are
|
||
|
|
<tt>:keep_session</tt>, <tt>:fixtures</tt> and <tt>:clear_tables</tt>
|
||
|
|
</p>
|
||
|
|
<pre>
|
||
|
|
setup
|
||
|
|
setup :keep_session
|
||
|
|
setup :fixtures => :all
|
||
|
|
setup :keep_session, :fixtures => [:foo, :bar]
|
||
|
|
setup :clear_tables => [:foo, :bar]
|
||
|
|
</pre>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000009-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 14</span>
|
||
|
|
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span> <span class="ruby-identifier">options</span> = {}
|
||
|
|
15: <span class="ruby-identifier">options</span> = {<span class="ruby-identifier">options</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>} <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
||
|
|
16:
|
||
|
|
17: <span class="ruby-identifier">opts</span> = {<span class="ruby-identifier">:controller</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'selenium'</span>, <span class="ruby-identifier">:action</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'setup'</span>}
|
||
|
|
18: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:keep_session</span>] = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">:keep_session</span>
|
||
|
|
19:
|
||
|
|
20: [<span class="ruby-identifier">:fixtures</span>, <span class="ruby-identifier">:clear_tables</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
||
|
|
21: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">f</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>])
|
||
|
|
22: <span class="ruby-identifier">f</span> = [<span class="ruby-identifier">f</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
|
||
|
|
23: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">join</span> <span class="ruby-value str">','</span>
|
||
|
|
24: <span class="ruby-keyword kw">end</span>
|
||
|
|
25: <span class="ruby-keyword kw">end</span>
|
||
|
|
26:
|
||
|
|
27: <span class="ruby-identifier">open</span> <span class="ruby-identifier">opts</span>
|
||
|
|
28: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000024" class="method-detail">
|
||
|
|
<a name="M000024"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000024" class="method-signature">
|
||
|
|
<span class="method-name">submit</span><span class="method-args">(locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Submit the specified form. This is particularly useful for forms without
|
||
|
|
submit buttons, e.g. single-input "Search" forms.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000024-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 156</span>
|
||
|
|
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit</span> <span class="ruby-identifier">locator</span>
|
||
|
|
157: <span class="ruby-identifier">command</span> <span class="ruby-value str">'submit'</span>, <span class="ruby-identifier">locator</span>
|
||
|
|
158: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000018" class="method-detail">
|
||
|
|
<a name="M000018"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000018" class="method-signature">
|
||
|
|
<span class="method-name">type</span><span class="method-args">(locator, value)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Sets the value of an input field, as though you typed it in.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Can also be used to set the value of combo boxes, check boxes, etc. In
|
||
|
|
these cases, <tt>value</tt> should be the value of the option selected, not
|
||
|
|
the visible text.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000018-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 97</span>
|
||
|
|
97: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span> <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">value</span>
|
||
|
|
98: <span class="ruby-identifier">command</span> <span class="ruby-value str">'type'</span>, <span class="ruby-identifier">locator</span>, <span class="ruby-identifier">value</span>
|
||
|
|
99: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000020" class="method-detail">
|
||
|
|
<a name="M000020"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000020" class="method-signature">
|
||
|
|
<span class="method-name">uncheck</span><span class="method-args">(locator)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Uncheck a toggle-button (checkbox/radio).
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000020-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 107</span>
|
||
|
|
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uncheck</span> <span class="ruby-identifier">locator</span>
|
||
|
|
108: <span class="ruby-identifier">command</span> <span class="ruby-value str">'uncheck'</span>, <span class="ruby-identifier">locator</span>
|
||
|
|
109: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000034" class="method-detail">
|
||
|
|
<a name="M000034"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000034" class="method-signature">
|
||
|
|
<span class="method-name">wait_for_condition</span><span class="method-args">(script, timeout)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Runs the specified JavaScript snippet repeatedly until it evaluates to
|
||
|
|
<tt>true</tt>. The snippet may have multiple lines, but only the result of
|
||
|
|
the last line will be considered.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Note that, by default, the snippet will be run in the runner’s test
|
||
|
|
window, not in the window of your application. To get the window of your
|
||
|
|
application, you can use the JavaScript snippet
|
||
|
|
<tt>selenium.browserbot.getCurrentWindow()</tt>, and then run your
|
||
|
|
JavaScript in there.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>timeout</tt> is specified in milliseconds.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000034-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 238</span>
|
||
|
|
238: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait_for_condition</span> <span class="ruby-identifier">script</span>, <span class="ruby-identifier">timeout</span>
|
||
|
|
239: <span class="ruby-identifier">command</span> <span class="ruby-value str">'waitForCondition'</span>, <span class="ruby-identifier">script</span>, <span class="ruby-identifier">timeout</span>
|
||
|
|
240: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000036" class="method-detail">
|
||
|
|
<a name="M000036"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000036" class="method-signature">
|
||
|
|
<span class="method-name">wait_for_page_to_load</span><span class="method-args">(timeout)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Waits for a new page to load.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
You can use this command instead of the <tt>and_wait</tt> suffixes,
|
||
|
|
<tt>click_and_wait</tt>, <tt>select_and_wait</tt>, <tt>type_and_wait</tt>
|
||
|
|
etc. (which are only available in the JS API).
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Selenium constantly keeps track of new pages loading, and sets a
|
||
|
|
<tt>newPageLoaded</tt> flag when it first notices a page load. Running any
|
||
|
|
other Selenium command after turns the flag to <tt>false</tt>. Hence, if
|
||
|
|
you want to wait for a page to load, you must wait immediately after a
|
||
|
|
Selenium command that caused a page-load.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
<tt>timeout</tt> is specified in milliseconds.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000036-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 268</span>
|
||
|
|
268: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait_for_page_to_load</span> <span class="ruby-identifier">timeout</span>
|
||
|
|
269: <span class="ruby-identifier">command</span> <span class="ruby-value str">'waitForPageToLoad'</span>, <span class="ruby-identifier">timeout</span>
|
||
|
|
270: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="method-M000027" class="method-detail">
|
||
|
|
<a name="M000027"></a>
|
||
|
|
|
||
|
|
<div class="method-heading">
|
||
|
|
<a href="#M000027" class="method-signature">
|
||
|
|
<span class="method-name">wait_for_popup</span><span class="method-args">(window_id, timeout)</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="method-description">
|
||
|
|
<p>
|
||
|
|
Waits for a popup window to appear and load up.
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
The <tt>timeout</tt> is specified in milliseconds.
|
||
|
|
</p>
|
||
|
|
<p><a class="source-toggle" href="#"
|
||
|
|
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
||
|
|
<div class="method-source-code" id="M000027-source">
|
||
|
|
<pre>
|
||
|
|
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder_actions.rb, line 179</span>
|
||
|
|
179: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait_for_popup</span> <span class="ruby-identifier">window_id</span>, <span class="ruby-identifier">timeout</span>
|
||
|
|
180: <span class="ruby-identifier">command</span> <span class="ruby-value str">'waitForPopUp'</span>, <span class="ruby-identifier">window_id</span><span class="ruby-operator">||</span><span class="ruby-value str">'null'</span>, <span class="ruby-identifier">timeout</span>
|
||
|
|
181: <span class="ruby-keyword kw">end</span>
|
||
|
|
</pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
<div id="validator-badges">
|
||
|
|
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</body>
|
||
|
|
</html>
|