blob: fd466d5457bb61d1820e0c5d7269ee8b299c7b0c [file] [log] [blame]
<!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::WebDriver::SearchContext
&mdash; 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 (S)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Selenium.html" title="Selenium (module)">Selenium</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../WebDriver.html" title="Selenium::WebDriver (module)">WebDriver</a></span></span>
&raquo;
<span class="title">SearchContext</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::WebDriver::SearchContext
</h1>
<dl class="box">
<dt class="r1">Included in:</dt>
<dd class="r1"><span class='object_link'><a href="Driver.html" title="Selenium::WebDriver::Driver (class)">Driver</a></span>, <span class='object_link'><a href="Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span></dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">rb/lib/selenium/webdriver/common/search_context.rb</dd>
</dl>
<div class="clear"></div>
<h2>Constant Summary</h2>
<dl class="constants">
<dt id="FINDERS-constant" class="">FINDERS =
<div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This constant is part of a private API.</strong>
You should avoid using this constant if possible, as it may be removed or be changed in the future.
</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='lbrace'>{</span>
<span class='symbol'>:class</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>class name</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:class_name</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>class name</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:css</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>css selector</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:id</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>id</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:link</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>link text</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:link_text</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>link text</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:partial_link_text</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>partial link text</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:tag_name</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tag name</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='symbol'>:xpath</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>xpath</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='rbrace'>}</span></pre></dd>
</dl>
<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="#find_element-instance_method" title="#find_element (instance method)">- (Element) <strong>find_element</strong>(*args) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Find the first element matching the given arguments.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#find_elements-instance_method" title="#find_elements (instance method)">- (Array&lt;Element&gt;) <strong>find_elements</strong>(*args) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Find all elements matching the given arguments.</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="find_element-instance_method">
- (<tt><span class='object_link'><a href="Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span></tt>) <strong>find_element</strong>(*args)
</h3><div class="docstring">
<div class="discussion">
<p>Find the first element matching the given arguments.</p>
<p>When using Element#find_element with :xpath, be aware that webdriver
follows standard conventions: a search prefixed with "//" will search the
entire document, not just the children of this current node. Use ".//" to
limit your search to the children of the receiving Element.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>how</span>
<span class='type'>(<tt>:class</tt>, <tt>:class_name</tt>, <tt>:css</tt>, <tt>:id</tt>, <tt>:link_text</tt>, <tt>:link</tt>, <tt>:partial_link_text</tt>, <tt>:name</tt>, <tt>:tag_name</tt>, <tt>:xpath</tt>)</span>
</li>
<li>
<span class='name'>what</span>
<span class='type'>(<tt><span class='object_link'><a href="../../String.html" title="String (class)">String</a></span></tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span></tt>)</span>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Error/NoSuchElementError.html" title="Selenium::WebDriver::Error::NoSuchElementError (class)">Error::NoSuchElementError</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>if the element doesn't exist</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
35
36
37
38
39
40
41
42
43</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/search_context.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_find_element'>find_element</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
<span class='id identifier rubyid_how'>how</span><span class='comma'>,</span> <span class='id identifier rubyid_what'>what</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_args'>extract_args</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_by'>by</span> <span class='op'>=</span> <span class='const'>FINDERS</span><span class='lbracket'>[</span><span class='id identifier rubyid_how'>how</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>cannot find element by </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_how'>how</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_bridge'>bridge</span><span class='period'>.</span><span class='id identifier rubyid_find_element_by'>find_element_by</span> <span class='id identifier rubyid_by'>by</span><span class='comma'>,</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="find_elements-instance_method">
- (<tt>Array&lt;<span class='object_link'><a href="Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span>&gt;</tt>) <strong>find_elements</strong>(*args)
</h3><div class="docstring">
<div class="discussion">
<p>Find all elements matching the given arguments</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>how</span>
<span class='type'>(<tt>:class</tt>, <tt>:class_name</tt>, <tt>:css</tt>, <tt>:id</tt>, <tt>:link_text</tt>, <tt>:link</tt>, <tt>:partial_link_text</tt>, <tt>:name</tt>, <tt>:tag_name</tt>, <tt>:xpath</tt>)</span>
</li>
<li>
<span class='name'>what</span>
<span class='type'>(<tt><span class='object_link'><a href="../../String.html" title="String (class)">String</a></span></tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span>&gt;</tt>)</span>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="#find_element-instance_method" title="Selenium::WebDriver::SearchContext#find_element (method)">#find_element</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
55
56
57
58
59
60
61
62
63</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/search_context.rb', line 55</span>
<span class='kw'>def</span> <span class='id identifier rubyid_find_elements'>find_elements</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
<span class='id identifier rubyid_how'>how</span><span class='comma'>,</span> <span class='id identifier rubyid_what'>what</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_args'>extract_args</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_by'>by</span> <span class='op'>=</span> <span class='const'>FINDERS</span><span class='lbracket'>[</span><span class='id identifier rubyid_how'>how</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>cannot find elements by </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_how'>how</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_bridge'>bridge</span><span class='period'>.</span><span class='id identifier rubyid_find_elements_by'>find_elements_by</span> <span class='id identifier rubyid_by'>by</span><span class='comma'>,</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Jul 19 12:32:24 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>