blob: 5d18d3ce85649bd56a162e89adc7c8288264fc74 [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>
Class: Selenium::WebDriver::TargetLocator
&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 (T)</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">TargetLocator</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>Class: Selenium::WebDriver::TargetLocator
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName">Object</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">Selenium::WebDriver::TargetLocator</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">rb/lib/selenium/webdriver/common/target_locator.rb</dd>
</dl>
<div class="clear"></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="#active_element-instance_method" title="#active_element (instance method)">- (WebDriver::Element) <strong>active_element</strong> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>get the active element.</p>
</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>switches to the currently active modal dialog for this particular driver
instance.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#default_content-instance_method" title="#default_content (instance method)">- (Object) <strong>default_content</strong> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>selects either the first frame on the page, or the main document when a
page contains iframes.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#frame-instance_method" title="#frame (instance method)">- (Object) <strong>frame</strong>(id) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>switch to the frame with the given id.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">- (TargetLocator) <strong>initialize</strong>(bridge) </a>
</span>
<span class="note title constructor">constructor</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'>
<p>A new instance of TargetLocator.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#window-instance_method" title="#window (instance method)">- (Object) <strong>window</strong>(id) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>switch to the given window handle.</p>
</div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
- (<tt><span class='object_link'><a href="" title="Selenium::WebDriver::TargetLocator (class)">TargetLocator</a></span></tt>) <strong>initialize</strong>(bridge)
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p>A new instance of TargetLocator</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
9
10
11</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/target_locator.rb', line 9</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_bridge'>bridge</span><span class='rparen'>)</span>
<span class='ivar'>@bridge</span> <span class='op'>=</span> <span class='id identifier rubyid_bridge'>bridge</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="active_element-instance_method">
- (<tt><span class='object_link'><a href="Element.html" title="Selenium::WebDriver::Element (class)">WebDriver::Element</a></span></tt>) <strong>active_element</strong>
</h3><div class="docstring">
<div class="discussion">
<p>get the active element</p>
</div>
</div>
<div class="tags">
<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)">WebDriver::Element</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
59
60
61</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/target_locator.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_active_element'>active_element</span>
<span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_switchToActiveElement'>switchToActiveElement</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>switches to the currently active modal dialog for this particular driver
instance</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
75
76
77</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/target_locator.rb', line 75</span>
<span class='kw'>def</span> <span class='id identifier rubyid_alert'>alert</span>
<span class='const'>Alert</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@bridge</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="default_content-instance_method">
- (<tt>Object</tt>) <strong>default_content</strong>
</h3><div class="docstring">
<div class="discussion">
<p>selects either the first frame on the page, or the main document when a
page contains iframes.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
67
68
69</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/target_locator.rb', line 67</span>
<span class='kw'>def</span> <span class='id identifier rubyid_default_content'>default_content</span>
<span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_switchToDefaultContent'>switchToDefaultContent</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="frame-instance_method">
- (<tt>Object</tt>) <strong>frame</strong>(id)
</h3><div class="docstring">
<div class="discussion">
<p>switch to the frame with the given id</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
17
18
19</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/target_locator.rb', line 17</span>
<span class='kw'>def</span> <span class='id identifier rubyid_frame'>frame</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
<span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_switchToFrame'>switchToFrame</span> <span class='id identifier rubyid_id'>id</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="window-instance_method">
- (<tt>Object</tt>) <strong>window</strong>(id)
</h3><div class="docstring">
<div class="discussion">
<p>switch to the given window handle</p>
<p>If given a block, this method will switch back to the original window after
block execution.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>id</span>
<span class='type'></span>
&mdash;
<div class='inline'>
<p>A window handle, obtained through Driver#window_handles</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/common/target_locator.rb', line 31</span>
<span class='kw'>def</span> <span class='id identifier rubyid_window'>window</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
<span class='id identifier rubyid_original'>original</span> <span class='op'>=</span> <span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_getCurrentWindowHandle'>getCurrentWindowHandle</span>
<span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_switchToWindow'>switchToWindow</span> <span class='id identifier rubyid_id'>id</span>
<span class='kw'>begin</span>
<span class='id identifier rubyid_returned'>returned</span> <span class='op'>=</span> <span class='kw'>yield</span>
<span class='kw'>ensure</span>
<span class='id identifier rubyid_current_handles'>current_handles</span> <span class='op'>=</span> <span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_getWindowHandles'>getWindowHandles</span>
<span class='kw'>if</span> <span class='id identifier rubyid_current_handles'>current_handles</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>1</span>
<span class='id identifier rubyid_original'>original</span> <span class='op'>=</span> <span class='id identifier rubyid_current_handles'>current_handles</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
<span class='kw'>end</span>
<span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_switchToWindow'>switchToWindow</span> <span class='id identifier rubyid_original'>original</span>
<span class='id identifier rubyid_returned'>returned</span>
<span class='kw'>end</span>
<span class='kw'>else</span>
<span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_switchToWindow'>switchToWindow</span> <span class='id identifier rubyid_id'>id</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Jul 19 12:32:31 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>