| <!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> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| <title> |
| Module: Selenium::Client::Idiomatic |
| |
| — Documentation by YARD 0.8.1 |
| |
| </title> |
| |
| <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" /> |
| |
| <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" /> |
| |
| <script type="text/javascript" charset="utf-8"> |
| hasFrames = window.top.frames.main ? true : false; |
| relpath = '../../'; |
| framesUrl = "../../frames.html#!" + escape(window.location.href); |
| </script> |
| |
| |
| <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> |
| |
| <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script> |
| |
| |
| </head> |
| <body> |
| <div id="header"> |
| <div id="menu"> |
| |
| <a href="../../_index.html">Index (I)</a> » |
| <span class='title'><span class='object_link'><a href="../../Selenium.html" title="Selenium (module)">Selenium</a></span></span> » <span class='title'><span class='object_link'><a href="../Client.html" title="Selenium::Client (module)">Client</a></span></span> |
| » |
| <span class="title">Idiomatic</span> |
| |
| |
| <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> |
| </div> |
| |
| <div id="search"> |
| |
| <a class="full_list_link" id="class_list_link" |
| href="../../class_list.html"> |
| Class List |
| </a> |
| |
| <a class="full_list_link" id="method_list_link" |
| href="../../method_list.html"> |
| Method List |
| </a> |
| |
| <a class="full_list_link" id="file_list_link" |
| href="../../file_list.html"> |
| File List |
| </a> |
| |
| </div> |
| <div class="clear"></div> |
| </div> |
| |
| <iframe id="search_frame"></iframe> |
| |
| <div id="content"><h1>Module: Selenium::Client::Idiomatic |
| |
| |
| |
| </h1> |
| |
| <dl class="box"> |
| |
| |
| |
| |
| |
| |
| |
| <dt class="r1">Included in:</dt> |
| <dd class="r1"><span class='object_link'><a href="Base.html" title="Selenium::Client::Base (module)">Base</a></span></dd> |
| |
| |
| |
| <dt class="r2 last">Defined in:</dt> |
| <dd class="r2 last">rb/lib/selenium/client/idiomatic.rb</dd> |
| |
| </dl> |
| <div class="clear"></div> |
| |
| <h2>Overview</h2><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Provide a more idiomatic API than the generated Ruby driver.</p> |
| |
| <p>Work in progress...</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| <h2> |
| Instance Method Summary |
| <small>(<a href="#" class="summary_toggle">collapse</a>)</small> |
| </h2> |
| |
| <ul class="summary"> |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#actual_timeout_in_milliseconds-instance_method" title="#actual_timeout_in_milliseconds (instance method)">- (Object) <strong>actual_timeout_in_milliseconds</strong>(timeout_in_seconds) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'></div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#alert-instance_method" title="#alert (instance method)">- (Object) <strong>alert</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Retrieves the message of a JavaScript alert generated during the previous |
| action, or fail if there were no alerts.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#alert%3F-instance_method" title="#alert? (instance method)">- (Boolean) <strong>alert?</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Whether an alert occurred.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#all_window_ids-instance_method" title="#all_window_ids (instance method)">- (Object) <strong>all_window_ids</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the IDs of all windows that the browser knows about.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#all_window_names-instance_method" title="#all_window_names (instance method)">- (Object) <strong>all_window_names</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the names of all windows that the browser knows about.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#all_window_titles-instance_method" title="#all_window_titles (instance method)">- (Object) <strong>all_window_titles</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the titles of all windows that the browser knows about.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#body_text-instance_method" title="#body_text (instance method)">- (Object) <strong>body_text</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Gets the entire text of the page.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#browser_network_traffic-instance_method" title="#browser_network_traffic (instance method)">- (Object) <strong>browser_network_traffic</strong>(format = :plain) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns a string representation of the network traffic seen by the browser, |
| including headers, AJAX requests, status codes, and timings.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#browser_xpath_library%3D-instance_method" title="#browser_xpath_library= (instance method)">- (Object) <strong>browser_xpath_library=</strong>(library_name) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Allows choice of a specific XPath libraries for Xpath evualuation in the |
| browser (e.g. to resolve XPath locators).</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#checked%3F-instance_method" title="#checked? (instance method)">- (Boolean) <strong>checked?</strong>(locator) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns whether a toggle-button (checkbox/radio) is checked.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#click-instance_method" title="#click (instance method)">- (Object) <strong>click</strong>(locator, options = {}) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Clicks on a link, button, checkbox or radio button.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#confirmation-instance_method" title="#confirmation (instance method)">- (Object) <strong>confirmation</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Retrieves the message of a JavaScript confirmation dialog generated during |
| the previous action.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#confirmation%3F-instance_method" title="#confirmation? (instance method)">- (Boolean) <strong>confirmation?</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Whether a confirmation has been auto-acknoledged (i.e. confirm() been |
| called).</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#cookie-instance_method" title="#cookie (instance method)">- (Object) <strong>cookie</strong>(name) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the value of the cookie with the specified name, or throws an error |
| if the cookie is not present.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#cookie%3F-instance_method" title="#cookie? (instance method)">- (Boolean) <strong>cookie?</strong>(name) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns true if a cookie with the specified name is present, or false |
| otherwise.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#cookies-instance_method" title="#cookies (instance method)">- (Object) <strong>cookies</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Return all cookies for the current page under test.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#create_cookie-instance_method" title="#create_cookie (instance method)">- (Object) <strong>create_cookie</strong>(name_value_pair, options = "") </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Create a new cookie whose path and domain are same with those of current |
| page under test, unless you specified a path for this cookie explicitly.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#delete_cookie-instance_method" title="#delete_cookie (instance method)">- (Object) <strong>delete_cookie</strong>(name, options = "") </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Delete a named cookie with specified path and domain.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#element%3F-instance_method" title="#element? (instance method)">- (Boolean) <strong>element?</strong>(locator) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Verifies that the specified element is somewhere on the page.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#execution_delay-instance_method" title="#execution_delay (instance method)">- (Object) <strong>execution_delay</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Get execution delay in milliseconds, i.e.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#execution_delay%3D-instance_method" title="#execution_delay= (instance method)">- (Object) <strong>execution_delay=</strong>(delay_in_milliseconds) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Set the execution delay in milliseconds, i.e.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#field-instance_method" title="#field (instance method)">- (Object) <strong>field</strong>(locator) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Gets the (whitespace-trimmed) value of an input field (or anything else |
| with a value parameter).</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#go_back-instance_method" title="#go_back (instance method)">- (Object) <strong>go_back</strong>(options = {}) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Simulates the user clicking the "back" button on their browser.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#highlight_located_element%3D-instance_method" title="#highlight_located_element= (instance method)">- (Object) <strong>highlight_located_element=</strong>(enabled) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Turn on/off the automatic hightlighting of the element driven or inspected |
| by Selenium core.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#js_eval-instance_method" title="#js_eval (instance method)">- (Object) <strong>js_eval</strong>(script) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the result of evaluating the specified JavaScript snippet whithin |
| the browser.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#location-instance_method" title="#location (instance method)">- (Object) <strong>location</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the absolute URL of the current page.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#prompt-instance_method" title="#prompt (instance method)">- (Object) <strong>prompt</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Retrieves the message of a JavaScript question prompt dialog generated |
| during the previous action.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#prompt%3F-instance_method" title="#prompt? (instance method)">- (Boolean) <strong>prompt?</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Whether a prompt occurred.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#remote_control_timeout_in_seconds%3D-instance_method" title="#remote_control_timeout_in_seconds= (instance method)">- (Object) <strong>remote_control_timeout_in_seconds=</strong>(timeout_in_seconds) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Set the Remote Control timeout (as opposed to the client side driver |
| timeout).</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#table_cell_text-instance_method" title="#table_cell_text (instance method)">- (Object) <strong>table_cell_text</strong>(tableCellAddress) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Returns the text from a cell of a table.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#text-instance_method" title="#text (instance method)">- (Object) <strong>text</strong>(locator) </a> |
| |
| |
| |
| (also: #text_content) |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Return the text content of an HTML element (rendered text shown to the |
| user).</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#text%3F-instance_method" title="#text? (instance method)">- (Boolean) <strong>text?</strong>(pattern) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Verifies that the specified text pattern appears somewhere on the rendered |
| page shown to the user.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#title-instance_method" title="#title (instance method)">- (Object) <strong>title</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Return the title of the current HTML page.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#value-instance_method" title="#value (instance method)">- (Object) <strong>value</strong>(locator) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Alias for <tt>field</tt>.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#visible%3F-instance_method" title="#visible? (instance method)">- (Boolean) <strong>visible?</strong>(locator) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Determines if the specified element is visible.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#wait_for-instance_method" title="#wait_for (instance method)">- (Object) <strong>wait_for</strong>(options) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Flexible wait semantics.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#wait_for_condition-instance_method" title="#wait_for_condition (instance method)">- (Object) <strong>wait_for_condition</strong>(script, timeout_in_seconds = nil) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Runs the specified JavaScript snippet repeatedly until it evaluates to |
| "true".</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#wait_for_page-instance_method" title="#wait_for_page (instance method)">- (Object) <strong>wait_for_page</strong>(timeout_in_seconds = nil) </a> |
| |
| |
| |
| (also: #wait_for_page_to_load) |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Waits for a new page to load.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#wait_for_popup-instance_method" title="#wait_for_popup (instance method)">- (Object) <strong>wait_for_popup</strong>(window_id, timeout_in_seconds = nil) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Waits for a popup window to appear and load up.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| </ul> |
| |
| |
| |
| |
| <div id="instance_method_details" class="method_details_list"> |
| <h2>Instance Method Details</h2> |
| |
| |
| <div class="method_details first"> |
| <h3 class="signature first" id="actual_timeout_in_milliseconds-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>actual_timeout_in_milliseconds</strong>(timeout_in_seconds) |
| |
| |
| |
| |
| |
| </h3><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 480 |
| 481 |
| 482 |
| 483 |
| 484</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 480</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_actual_timeout_in_milliseconds'>actual_timeout_in_milliseconds</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_actual_timeout'>actual_timeout</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span> <span class='op'>||</span> |
| <span class='id identifier rubyid_default_timeout_in_seconds'>default_timeout_in_seconds</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> |
| <span class='id identifier rubyid_actual_timeout'>actual_timeout</span> <span class='op'>*</span> <span class='int'>1000</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="alert-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>alert</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Retrieves the message of a JavaScript alert generated during the previous |
| action, or fail if there were no alerts.</p> |
| |
| <p>Getting an alert has the same effect as manually clicking OK. If an alert |
| is generated but you do not consume it with getAlert, the next Selenium |
| action will fail.</p> |
| |
| <p>Under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.</p> |
| |
| <p>Selenium does NOT support JavaScript alerts that are generated in a page's |
| onload() event handler. In this case a visible dialog WILL be generated and |
| Selenium will hang until someone manually clicks OK.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 220 |
| 221 |
| 222</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 220</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_alert'>alert</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getAlert</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="alert?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>alert?</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Whether an alert occurred</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 202 |
| 203 |
| 204</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 202</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_alert?'>alert?</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isAlertPresent</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="all_window_ids-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>all_window_ids</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the IDs of all windows that the browser knows about.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 408 |
| 409 |
| 410</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 408</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_all_window_ids'>all_window_ids</span> |
| <span class='id identifier rubyid_string_array_command'>string_array_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getAllWindowIds</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="all_window_names-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>all_window_names</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the names of all windows that the browser knows about.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 414 |
| 415 |
| 416</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 414</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_all_window_names'>all_window_names</span> |
| <span class='id identifier rubyid_string_array_command'>string_array_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getAllWindowNames</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="all_window_titles-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>all_window_titles</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the titles of all windows that the browser knows about.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 420 |
| 421 |
| 422</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 420</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_all_window_titles'>all_window_titles</span> |
| <span class='id identifier rubyid_string_array_command'>string_array_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getAllWindowTitles</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="body_text-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>body_text</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Gets the entire text of the page.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 115 |
| 116 |
| 117</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 115</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_body_text'>body_text</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getBodyText</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="browser_network_traffic-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>browser_network_traffic</strong>(format = :plain) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns a string representation of the network traffic seen by the browser, |
| including headers, AJAX requests, status codes, and timings. When this |
| function is called, the traffic log is cleared, so the returned content is |
| only the traffic seen since the last call.</p> |
| |
| <p>The network traffic is returned in the format it was requested. Valid |
| values are: :json, :xml, or :plain.</p> |
| |
| <p>Warning: For browser_network_traffic to work you need to start your browser |
| session with the option "captureNetworkTraffic=true", which will force ALL |
| traffic to go to the Remote Control proxy even for more efficient browser |
| modes like `*firefox` and `*safari`.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 436 |
| 437 |
| 438 |
| 439 |
| 440 |
| 441</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 436</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_browser_network_traffic'>browser_network_traffic</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:plain</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>format must be :plain, :json, or :xml</span><span class='tstring_end'>"</span></span> \ |
| <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='symbol'>:plain</span><span class='comma'>,</span> <span class='symbol'>:json</span><span class='comma'>,</span> <span class='symbol'>:xml</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span> |
| |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>captureNetworkTraffic</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="browser_xpath_library=-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>browser_xpath_library=</strong>(library_name) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Allows choice of a specific XPath libraries for Xpath evualuation in the |
| browser (e.g. to resolve XPath locators).</p> |
| |
| <p>`library_name' can be:</p> |
| |
| <pre class="code ruby"><code>* :ajaxslt : Google's library |
| * :javascript-xpath : Cybozu Labs' faster library |
| * :default : Selenium default library.</code></pre> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 450 |
| 451 |
| 452 |
| 453 |
| 454</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 450</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_browser_xpath_library='>browser_xpath_library=</span><span class='lparen'>(</span><span class='id identifier rubyid_library_name'>library_name</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>library name must be :ajaxslt, :javascript-xpath, or :default</span><span class='tstring_end'>"</span></span> \ |
| <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='symbol'>:ajaxslt</span><span class='comma'>,</span> <span class='symbol'>:javascript-xpath</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:default</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_library_name'>library_name</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>useXpathLibrary</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_library_name'>library_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="checked?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>checked?</strong>(locator) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns whether a toggle-button (checkbox/radio) is checked. Fails if the |
| specified element doesn't exist or isn't a toggle-button.</p> |
| <ul><li> |
| <p>'locator' is an element locator pointing to a checkbox or radio button</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 197 |
| 198 |
| 199</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 197</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_checked?'>checked?</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isChecked</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="click-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>click</strong>(locator, options = {}) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Clicks on a link, button, checkbox or radio button.</p> |
| |
| <p>'locator' is an element locator</p> |
| |
| <p>Using 'options' you can automatically wait for an event to happen after the |
| click. e.g.</p> |
| <ul><li> |
| <p>click "a_locator", :wait_for => :page |
| # will wait for a new page to load</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :popup, :window => 'a window id' |
| # will wait for a new popup window to appear. Also selects the popup window |
| for you provide `:select => true`</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :ajax |
| # will wait for all ajax requests to be completed using semantics of |
| default javascript framework</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :ajax, :javascript_framework => |
| :jquery # will wait for all ajax requests to be |
| completed overriding default javascript framework</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :effects |
| # will wait for all javascript effects to be rendered using semantics of |
| default javascript framework</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :effects, :javascript_framework => |
| :prototype # will wait for all javascript effects to be |
| rendered overriding default javascript framework</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :element, :element => |
| 'new_element_id' # will wait for an element to be |
| present/appear</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :no_element, :element => |
| 'new_element_id' # will wait for an element to be not be |
| present/disappear</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :text, :text => 'some text' |
| # will wait for some text to be present/appear</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :text, :text => /A Regexp/ |
| # will wait for some text to be present/appear</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :text, :element => 'a_locator', :text |
| => 'some text' # will wait for the content of 'a_locator' to be |
| 'some text'</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :no_text, :text => 'some text' |
| # will wait for the text to be not be present/disappear</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :no_text, :text => /A Regexp/ |
| # will wait for the text to be not be present/disappear</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :no_text, :element => 'a_locator', |
| :text => 'some text' # will wait for the content of 'a_locator' to |
| not be 'some text'</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :value, :element => 'a_locator', |
| :value => 'some value' # will wait for the field value of 'a_locator' |
| to be 'some value'</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :no_value, :element => 'a_locator', |
| :value => 'some value' # will wait for the field value of 'a_locator' to |
| not be 'some value'</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :visible, :element => 'a_locator' |
| # will wait for element to be visible</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :not_visible, :element => 'a_locator' |
| # will wait for element to not be visible</p> |
| </li><li> |
| <p>click "a_locator", :wait_for => :condition, :javascript => 'some |
| expression' # will wait for the javascript expression to be |
| true</p> |
| </li></ul> |
| |
| <p>Using options you can also define an explicit timeout (:timeout_in_seconds |
| key). Otherwise the default driver timeout is used.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 148 |
| 149 |
| 150 |
| 151</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 148</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_click'>click</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>click</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='id identifier rubyid_wait_for'>wait_for</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="confirmation-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>confirmation</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Retrieves the message of a JavaScript confirmation dialog generated during |
| the previous action.</p> |
| |
| <p>By default, the confirm function will return true, having the same effect |
| as manually clicking OK. This can be changed by prior execution of the |
| chooseCancelOnNextConfirmation command.</p> |
| |
| <p>If an confirmation is generated but you do not consume it with |
| getConfirmation, the next Selenium action will fail.</p> |
| |
| <p>NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible |
| dialog.</p> |
| |
| <p>NOTE: Selenium does NOT support JavaScript confirmations that are generated |
| in a page's onload() event handler. In this case a visible dialog WILL be |
| generated and Selenium will hang until you manually click OK.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 246 |
| 247 |
| 248</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 246</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_confirmation'>confirmation</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getConfirmation</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="confirmation?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>confirmation?</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Whether a confirmation has been auto-acknoledged (i.e. confirm() been |
| called)</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 225 |
| 226 |
| 227</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 225</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_confirmation?'>confirmation?</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isConfirmationPresent</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="cookie-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>cookie</strong>(name) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the value of the cookie with the specified name, or throws an error |
| if the cookie is not present.</p> |
| |
| <p>'name' is the name of the cookie</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 362 |
| 363 |
| 364</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 362</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_cookie'>cookie</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getCookieByName</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="cookie?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>cookie?</strong>(name) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns true if a cookie with the specified name is present, or false |
| otherwise.</p> |
| |
| <p>'name' is the name of the cookie</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 369 |
| 370 |
| 371</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 369</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_cookie?'>cookie?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isCookiePresent</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="cookies-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>cookies</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Return all cookies for the current page under test.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 355 |
| 356 |
| 357</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 355</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_cookies'>cookies</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getCookie</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="create_cookie-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>create_cookie</strong>(name_value_pair, options = "") |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Create a new cookie whose path and domain are same with those of current |
| page under test, unless you specified a path for this cookie explicitly.</p> |
| |
| <p>'nameValuePair' is name and value of the cookie in a format "name=value" |
| 'optionsString' is options for the cookie. Currently supported options |
| include 'path', 'max_age' and 'domain'. the optionsString's format is |
| "path=/path/, max_age=60, domain=.foo.com". The order of options are |
| irrelevant, the unit of the value of 'max_age' is second. Note that |
| specifying a domain that isn't a subset of the current domain will |
| usually fail.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 379 |
| 380 |
| 381 |
| 382 |
| 383 |
| 384</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 379</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_create_cookie'>create_cookie</span><span class='lparen'>(</span><span class='id identifier rubyid_name_value_pair'>name_value_pair</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
| <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span> <span class='const'>Hash</span> |
| <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
| <span class='kw'>end</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>createCookie</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_name_value_pair'>name_value_pair</span><span class='comma'>,</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="delete_cookie-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>delete_cookie</strong>(name, options = "") |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Delete a named cookie with specified path and domain. Be careful; to |
| delete a cookie, you need to delete it using the exact same path and domain |
| that were used to create the cookie. If the path is wrong, or the domain is |
| wrong, the cookie simply won't be deleted. Also note that specifying a |
| domain that isn't a subset of the current domain will usually fail.</p> |
| |
| <p>Since there's no way to discover at runtime the original path and domain of |
| a given cookie, we've added an option called 'recurse' to try all |
| sub-domains of the current domain with all paths that are a subset of the |
| current path. Beware; this option can be slow. In big-O notation, it |
| operates in O(n*m) time, where n is the number of dots in the domain name |
| and m is the number of slashes in the path.</p> |
| |
| <p>'name' is the name of the cookie to be deleted 'optionsString' is options |
| for the cookie. Currently supported options include 'path', 'domain' |
| and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, |
| recurse=true". The order of options are irrelevant. Note that |
| specifying a domain that isn't a subset of the current domain will |
| usually fail.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 399 |
| 400 |
| 401 |
| 402 |
| 403 |
| 404 |
| 405</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 399</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_delete_cookie'>delete_cookie</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
| <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span> <span class='const'>Hash</span> |
| <span class='id identifier rubyid_ordered_keys'>ordered_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'><=></span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='rbrace'>}</span> |
| <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_ordered_keys'>ordered_keys</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
| <span class='kw'>end</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deleteCookie</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="element?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>element?</strong>(locator) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Verifies that the specified element is somewhere on the page.</p> |
| <ul><li> |
| <p>'locator' is an element locator</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 163 |
| 164 |
| 165</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 163</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_element?'>element?</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isElementPresent</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="execution_delay-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>execution_delay</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Get execution delay in milliseconds, i.e. a pause delay following each |
| selenium operation. By default, there is no such delay (value is 0).</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 468 |
| 469 |
| 470</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 468</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_execution_delay'>execution_delay</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getSpeed</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="execution_delay=-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>execution_delay=</strong>(delay_in_milliseconds) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Set the execution delay in milliseconds, i.e. a pause delay following each |
| selenium operation. By default, there is no such delay.</p> |
| |
| <p>Setting an execution can be useful to troubleshoot or capture videos</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 476 |
| 477 |
| 478</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 476</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_execution_delay='>execution_delay=</span><span class='lparen'>(</span><span class='id identifier rubyid_delay_in_milliseconds'>delay_in_milliseconds</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>setSpeed</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_delay_in_milliseconds'>delay_in_milliseconds</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="field-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>field</strong>(locator) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Gets the (whitespace-trimmed) value of an input field (or anything else |
| with a value parameter). For checkbox/radio elements, the value will be |
| "on" or "off" depending on whether the element is checked or not.</p> |
| <ul><li> |
| <p>'locator' is an element locator</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 184 |
| 185 |
| 186</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 184</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getValue</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="go_back-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>go_back</strong>(options = {}) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Simulates the user clicking the "back" button on their browser. Using |
| 'options' you can automatically wait for an event to happen after the |
| click. e.g.</p> |
| <ul><li> |
| <p>go_back :wait_for => :page |
| # will wait for a new page to load</p> |
| </li><li> |
| <p>go_back :wait_for => :popup, :window => 'a window id' |
| # will wait for a new popup window to appear. Also selects the popup window |
| for you provide `:select => true`</p> |
| </li><li> |
| <p>go_back :wait_for => :ajax |
| # will wait for all ajax requests to be completed using semantics of |
| default javascript framework</p> |
| </li><li> |
| <p>go_back :wait_for => :ajax, :javascript_framework => :jquery |
| # will wait for all ajax requests to be completed overriding default |
| javascript framework</p> |
| </li><li> |
| <p>go_back :wait_for => :effects |
| # will wait for all javascript effects to be rendered using semantics of |
| default javascript framework</p> |
| </li><li> |
| <p>go_back :wait_for => :effects, :javascript_framework => :prototype |
| # will wait for all javascript effects to be rendered overriding default |
| javascript framework</p> |
| </li><li> |
| <p>go_back :wait_for => :element, :element => 'new_element_id' |
| # will wait for an element to be present/appear</p> |
| </li><li> |
| <p>go_back :wait_for => :no_element, :element => 'new_element_id' |
| # will wait for an element to be not be present/disappear</p> |
| </li><li> |
| <p>go_back :wait_for => :text, :text => 'some text' |
| # will wait for some text to be present/appear</p> |
| </li><li> |
| <p>go_back "a_locator", :wait_for => :text, :text => /A Regexp/ |
| # will wait for some text to be present/appear</p> |
| </li><li> |
| <p>go_back :wait_for => :text, :element => 'a_locator', :text => |
| 'some text' # will wait for the content of 'a_locator' to be 'some |
| text'</p> |
| </li><li> |
| <p>go_back :wait_for => :no_text, :text => 'some text' |
| # will wait for the text to be not be present/disappear</p> |
| </li><li> |
| <p>go_back "a_locator", :wait_for => :no_text, :text => /A Regexp/ |
| # will wait for the text to be not be present/disappear</p> |
| </li><li> |
| <p>go_back :wait_for => :no_text, :element => 'a_locator', :text => |
| 'some text' # will wait for the content of 'a_locator' to not be 'some |
| text'</p> |
| </li><li> |
| <p>go_back :wait_for => :condition, :javascript => 'some expression' |
| # will wait for the javascript expression to be true</p> |
| </li><li> |
| <p>go_back :wait_for => :value, :element => 'a_locator', :value => |
| 'some value' # will wait for the field value of 'a_locator' to be 'some |
| value'</p> |
| </li><li> |
| <p>go_back :wait_for => :visible, :element => 'a_locator' |
| # will wait for element to be visible</p> |
| </li><li> |
| <p>go_back :wait_for => :not_visible, :element => 'a_locator' |
| # will wait for element to not be visible</p> |
| </li><li> |
| <p>go_back :wait_for => :no_value, :element => 'a_locator', :value => |
| 'some value' # will wait for the field value of 'a_locator' to not be 'some |
| value'</p> |
| </li></ul> |
| |
| <p>Using options you can also define an explicit timeout (:timeout_in_seconds |
| key). Otherwise the default driver timeout is used.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 349 |
| 350 |
| 351 |
| 352</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 349</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_go_back'>go_back</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>goBack</span><span class='tstring_end'>"</span></span> |
| <span class='id identifier rubyid_wait_for'>wait_for</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="highlight_located_element=-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>highlight_located_element=</strong>(enabled) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Turn on/off the automatic hightlighting of the element driven or inspected |
| by Selenium core. Useful when recording videos</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 460 |
| 461 |
| 462 |
| 463</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 460</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_highlight_located_element='>highlight_located_element=</span><span class='lparen'>(</span><span class='id identifier rubyid_enabled'>enabled</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_boolean'>boolean</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='kw'>true</span> <span class='op'>==</span> <span class='id identifier rubyid_enabled'>enabled</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_js_eval'>js_eval</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>selenium.browserbot.shouldHighlightLocatedElement = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_boolean'>boolean</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="js_eval-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>js_eval</strong>(script) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the result of evaluating the specified JavaScript snippet whithin |
| the browser.</p> |
| |
| <pre class="code ruby"><code>The snippet may have multiple lines, but only the result of the last line will be returned.</code></pre> |
| |
| <p>Note that, by default, the snippet will run in the context of the |
| "selenium" object itself, so <tt>this</tt> will refer to the Selenium |
| object. Use <tt>window</tt> to refer to the window of your application, |
| e.g. <tt>window.document.getElementById('foo')</tt> If you need to use a |
| locator to refer to a single element in your application page, you can use |
| <tt>this.browserbot.findElement("id=foo")</tt> where "id=foo" is |
| your locator.</p> |
| <ul><li> |
| <p>'script' is the JavaScript snippet to run</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 283 |
| 284 |
| 285</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 283</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_js_eval'>js_eval</span><span class='lparen'>(</span><span class='id identifier rubyid_script'>script</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getEval</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_script'>script</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="location-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>location</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the absolute URL of the current page.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 30 |
| 31 |
| 32</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 30</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_location'>location</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getLocation</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="prompt-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>prompt</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Retrieves the message of a JavaScript question prompt dialog generated |
| during the previous action.</p> |
| |
| <p>Successful handling of the prompt requires prior execution of the |
| answerOnNextPrompt command. If a prompt is generated but you do not |
| get/verify it, the next Selenium action will fail.</p> |
| |
| <p>NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog.</p> |
| |
| <p>NOTE: Selenium does NOT support JavaScript prompts that are generated in a |
| page's onload() event handler. In this case a visible dialog WILL be |
| generated and Selenium will hang until someone manually clicks OK.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 268 |
| 269 |
| 270</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 268</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_prompt'>prompt</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getPrompt</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="prompt?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>prompt?</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Whether a prompt occurred</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 251 |
| 252 |
| 253</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 251</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_prompt?'>prompt?</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isPromptPresent</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="remote_control_timeout_in_seconds=-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>remote_control_timeout_in_seconds=</strong>(timeout_in_seconds) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Set the Remote Control timeout (as opposed to the client side driver |
| timeout). This timout specifies the amount of time that Selenium Core will |
| wait for actions to complete.</p> |
| |
| <p>The default timeout is 30 seconds. 'timeout' is a timeout in seconds, after |
| which the action will return with an error</p> |
| |
| <p>Actions that require waiting include "open" and the "waitFor*" actions.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 294 |
| 295 |
| 296</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 294</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_remote_control_timeout_in_seconds='>remote_control_timeout_in_seconds=</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>setTimeout</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_actual_timeout_in_milliseconds'>actual_timeout_in_milliseconds</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='rparen'>)</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="table_cell_text-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>table_cell_text</strong>(tableCellAddress) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Returns the text from a cell of a table. The cellAddress syntax |
| tableLocator.row.column, where row and column start at 0.</p> |
| <ul><li> |
| <p>'tableCellAddress' is a cell address, e.g. "foo.1.4"</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 302 |
| 303 |
| 304</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 302</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_table_cell_text'>table_cell_text</span><span class='lparen'>(</span><span class='id identifier rubyid_tableCellAddress'>tableCellAddress</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getTable</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_tableCellAddress'>tableCellAddress</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="text-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>text</strong>(locator) |
| |
| |
| |
| <span class="aliases">Also known as: |
| <span class="names"><span id='text_content-instance_method'>text_content</span></span> |
| </span> |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Return the text content of an HTML element (rendered text shown to the |
| user). Works for any HTML element that contains text.</p> |
| |
| <p>This command uses either the textContent (Mozilla-like browsers) or the |
| innerText (IE-like browsers) of the element, which is the rendered text |
| shown to the user.</p> |
| <ul><li> |
| <p>'locator' is an Selenium element locator</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 19 |
| 20 |
| 21</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 19</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_text'>text</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getText</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="text?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>text?</strong>(pattern) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Verifies that the specified text pattern appears somewhere on the rendered |
| page shown to the user.</p> |
| <ul><li> |
| <p>'pattern' is a pattern to match with the text of the page</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 156 |
| 157 |
| 158</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 156</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_text?'>text?</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isTextPresent</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="title-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>title</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Return the title of the current HTML page.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 25 |
| 26 |
| 27</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 25</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_title'>title</span> |
| <span class='id identifier rubyid_string_command'>string_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>getTitle</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="value-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>value</strong>(locator) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Alias for <tt>field</tt></p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 189 |
| 190 |
| 191</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 189</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_field'>field</span> <span class='id identifier rubyid_locator'>locator</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="visible?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>visible?</strong>(locator) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Determines if the specified element is visible. An element can be rendered |
| invisible by setting the CSS "visibility" property to "hidden", or the |
| "display" property to "none", either for the element itself or one if its |
| ancestors. This method will fail if the element is not present.</p> |
| |
| <p>'locator' is an element locator</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Boolean</tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 174 |
| 175 |
| 176</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 174</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_visible?'>visible?</span><span class='lparen'>(</span><span class='id identifier rubyid_locator'>locator</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_boolean_command'>boolean_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>isVisible</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locator'>locator</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="wait_for-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>wait_for</strong>(options) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Flexible wait semantics. ait is happening browser side. Useful for testing |
| AJAX application.</p> |
| <ul><li> |
| <p>wait :wait_for => :page |
| # will wait for a new page to load</p> |
| </li><li> |
| <p>wait :wait_for => :popup, :window => 'a window id' |
| # will wait for a new popup window to appear. Also selects the popup window |
| for you provide `:select => true`</p> |
| </li><li> |
| <p>wait :wait_for => :ajax |
| # will wait for all ajax requests to be completed using semantics of |
| default javascript framework</p> |
| </li><li> |
| <p>wait :wait_for => :ajax, :javascript_framework => :jquery |
| # will wait for all ajax requests to be completed overriding default |
| javascript framework</p> |
| </li><li> |
| <p>wait :wait_for => :effects |
| # will wait for all javascript effects to be rendered using semantics of |
| default javascript framework</p> |
| </li><li> |
| <p>wait :wait_for => :effects, :javascript_framework => :prototype |
| # will wait for all javascript effects to be rendered overriding default |
| javascript framework</p> |
| </li><li> |
| <p>wait :wait_for => :element, :element => 'new_element_id' |
| # will wait for an element to be present/appear</p> |
| </li><li> |
| <p>wait :wait_for => :no_element, :element => 'new_element_id' |
| # will wait for an element to be not be present/disappear</p> |
| </li><li> |
| <p>wait :wait_for => :text, :text => 'some text' |
| # will wait for some text to be present/appear</p> |
| </li><li> |
| <p>wait :wait_for => :text, :text => /A Regexp/ |
| # will wait for some text to be present/appear</p> |
| </li><li> |
| <p>wait :wait_for => :text, :element => 'a_locator', :text => 'some |
| text' # will wait for the content of 'a_locator' to be 'some text'</p> |
| </li><li> |
| <p>wait :wait_for => :no_text, :text => 'some text' |
| # will wait for the text to be not be present/disappear</p> |
| </li><li> |
| <p>wait :wait_for => :no_text, :text => /A Regexp/ |
| # will wait for the text to be not be present/disappear</p> |
| </li><li> |
| <p>wait :wait_for => :no_text, :element => 'a_locator', :text => |
| 'some text' # will wait for the content of 'a_locator' to not be 'some |
| text'</p> |
| </li><li> |
| <p>wait :wait_for => :value, :element => 'a_locator', :value => 'some |
| value' # will wait for the field value of 'a_locator' to be 'some value'</p> |
| </li><li> |
| <p>wait :wait_for => :no_value, :element => 'a_locator', :value => |
| 'some value' # will wait for the field value of 'a_locator' to not be 'some |
| value'</p> |
| </li><li> |
| <p>wait :wait_for => :visible, :element => 'a_locator' |
| # will wait for element to be visible</p> |
| </li><li> |
| <p>wait :wait_for => :not_visible, :element => 'a_locator' |
| # will wait for element to not be visible</p> |
| </li><li> |
| <p>wait :wait_for => :condition, :javascript => 'some expression' |
| # will wait for the javascript expression to be true</p> |
| </li></ul> |
| |
| <p>Using options you can also define an explicit timeout (:timeout_in_seconds |
| key). Otherwise the default driver timeout is used.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 83 |
| 84 |
| 85 |
| 86 |
| 87 |
| 88 |
| 89 |
| 90 |
| 91 |
| 92 |
| 93 |
| 94 |
| 95 |
| 96 |
| 97 |
| 98 |
| 99 |
| 100 |
| 101 |
| 102 |
| 103 |
| 104 |
| 105 |
| 106 |
| 107 |
| 108 |
| 109 |
| 110 |
| 111 |
| 112</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 83</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_wait_for'>wait_for</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> |
| <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:page</span> |
| <span class='id identifier rubyid_wait_for_page'>wait_for_page</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:timeout_in_seconds</span><span class='rbracket'>]</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:ajax</span> |
| <span class='id identifier rubyid_wait_for_ajax'>wait_for_ajax</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:element</span> |
| <span class='id identifier rubyid_wait_for_element'>wait_for_element</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:element</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:no_element</span> |
| <span class='id identifier rubyid_wait_for_no_element'>wait_for_no_element</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:element</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:text</span> |
| <span class='id identifier rubyid_wait_for_text'>wait_for_text</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:text</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:no_text</span> |
| <span class='id identifier rubyid_wait_for_no_text'>wait_for_no_text</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:text</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:effects</span> |
| <span class='id identifier rubyid_wait_for_effects'>wait_for_effects</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:popup</span> |
| <span class='id identifier rubyid_wait_for_popup'>wait_for_popup</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:window</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:timeout_in_seconds</span><span class='rbracket'>]</span> |
| <span class='id identifier rubyid_select_window'>select_window</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:window</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:select</span><span class='rbracket'>]</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:value</span> |
| <span class='id identifier rubyid_wait_for_field_value'>wait_for_field_value</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:element</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:value</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:no_value</span> |
| <span class='id identifier rubyid_wait_for_no_field_value'>wait_for_no_field_value</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:element</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:value</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:visible</span> |
| <span class='id identifier rubyid_wait_for_visible'>wait_for_visible</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:element</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:not_visible</span> |
| <span class='id identifier rubyid_wait_for_not_visible'>wait_for_not_visible</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:element</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='kw'>elsif</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:wait_for</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:condition</span> |
| <span class='id identifier rubyid_wait_for_condition'>wait_for_condition</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:javascript</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:timeout_in_seconds</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="wait_for_condition-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>wait_for_condition</strong>(script, timeout_in_seconds = nil) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Runs the specified JavaScript snippet repeatedly until it evaluates to |
| "true". 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> |
| <ul><li> |
| <p>'script' is the JavaScript snippet to run</p> |
| </li><li> |
| <p>'timeout_in_seconds' is a timeout in seconds, after which this command will |
| return with an error</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 318 |
| 319 |
| 320 |
| 321</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 318</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_wait_for_condition'>wait_for_condition</span><span class='lparen'>(</span><span class='id identifier rubyid_script'>script</span><span class='comma'>,</span> <span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>waitForCondition</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> |
| <span class='lbracket'>[</span><span class='id identifier rubyid_script'>script</span><span class='comma'>,</span> <span class='id identifier rubyid_actual_timeout_in_milliseconds'>actual_timeout_in_milliseconds</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='rparen'>)</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="wait_for_page-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>wait_for_page</strong>(timeout_in_seconds = nil) |
| |
| |
| |
| <span class="aliases">Also known as: |
| <span class="names"><span id='wait_for_page_to_load-instance_method'>wait_for_page_to_load</span></span> |
| </span> |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Waits for a new page to load.</p> |
| |
| <p>Selenium constantly keeps track of new pages loading, and sets a |
| "newPageLoaded" flag when it first notices a page load. Running any other |
| Selenium command after turns the flag to false. 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> |
| <ul><li> |
| <p>'timeout_in_seconds' is a timeout in seconds, after which this command will |
| return with an error</p> |
| </li></ul> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 44 |
| 45 |
| 46 |
| 47</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 44</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_wait_for_page'>wait_for_page</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>waitForPageToLoad</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> |
| <span class='lbracket'>[</span><span class='id identifier rubyid_actual_timeout_in_milliseconds'>actual_timeout_in_milliseconds</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='rparen'>)</span><span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="wait_for_popup-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>wait_for_popup</strong>(window_id, timeout_in_seconds = nil) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Waits for a popup window to appear and load up.</p> |
| |
| <p>window_id is the JavaScript window "name" of the window that will appear |
| (not the text of the title bar) timeout_in_seconds is a timeout in seconds, |
| after which the action will return with an error</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 54 |
| 55 |
| 56 |
| 57</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/client/idiomatic.rb', line 54</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_wait_for_popup'>wait_for_popup</span><span class='lparen'>(</span><span class='id identifier rubyid_window_id'>window_id</span><span class='comma'>,</span> <span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_remote_control_command'>remote_control_command</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>waitForPopUp</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> |
| <span class='lbracket'>[</span><span class='id identifier rubyid_window_id'>window_id</span><span class='comma'>,</span> <span class='id identifier rubyid_actual_timeout_in_milliseconds'>actual_timeout_in_milliseconds</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_seconds'>timeout_in_seconds</span><span class='rparen'>)</span> <span class='comma'>,</span><span class='rbracket'>]</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| </div> |
| |
| </div> |
| |
| <div id="footer"> |
| Generated on Thu Jul 19 12:32:22 2012 by |
| <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> |
| 0.8.1 (ruby-1.9.3). |
| </div> |
| |
| </body> |
| </html> |