| <!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::Support::Select |
| |
| — 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> » |
| <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="../../WebDriver.html" title="Selenium::WebDriver (module)">WebDriver</a></span></span> » <span class='title'><span class='object_link'><a href="../Support.html" title="Selenium::WebDriver::Support (module)">Support</a></span></span> |
| » |
| <span class="title">Select</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::Support::Select |
| |
| |
| |
| </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::Support::Select</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/support/select.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="#deselect_all-instance_method" title="#deselect_all (instance method)">- (Object) <strong>deselect_all</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Deselect all selected options.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#deselect_by-instance_method" title="#deselect_by (instance method)">- (Object) <strong>deselect_by</strong>(how, what) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Deselect options by visible text, index or value.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#first_selected_option-instance_method" title="#first_selected_option (instance method)">- (Element) <strong>first_selected_option</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Get the first selected option in this select element.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#initialize-instance_method" title="#initialize (instance method)">- (Select) <strong>initialize</strong>(element) </a> |
| |
| |
| |
| </span> |
| |
| |
| <span class="note title constructor">constructor</span> |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>A new instance of Select.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#multiple%3F-instance_method" title="#multiple? (instance method)">- (Boolean) <strong>multiple?</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Does this select element support selecting multiple options?.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#options-instance_method" title="#options (instance method)">- (Array<Element>) <strong>options</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Get all options for this select element.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#select_all-instance_method" title="#select_all (instance method)">- (Object) <strong>select_all</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Select all unselected options.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#select_by-instance_method" title="#select_by (instance method)">- (Object) <strong>select_by</strong>(how, what) </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Select options by visible text, index or value.</p> |
| </div></span> |
| |
| </li> |
| |
| |
| <li class="public "> |
| <span class="summary_signature"> |
| |
| <a href="#selected_options-instance_method" title="#selected_options (instance method)">- (Array<Element>) <strong>selected_options</strong> </a> |
| |
| |
| |
| </span> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <span class="summary_desc"><div class='inline'> |
| <p>Get all selected options for this select element.</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::Support::Select (class)">Select</a></span></tt>) <strong>initialize</strong>(element) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>A new instance of Select</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| <p class="tag_title">Parameters:</p> |
| <ul class="param"> |
| |
| <li> |
| |
| <span class='name'>element</span> |
| |
| |
| <span class='type'>(<tt><span class='object_link'><a href="../Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span></tt>)</span> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>The select element to use</p> |
| </div> |
| |
| </li> |
| |
| </ul> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 10</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_element'>element</span><span class='rparen'>)</span> |
| <span class='id identifier rubyid_tag_name'>tag_name</span> <span class='op'>=</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_tag_name'>tag_name</span> |
| |
| <span class='kw'>unless</span> <span class='id identifier rubyid_tag_name'>tag_name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>select</span><span class='tstring_end'>"</span></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'>"</span><span class='tstring_content'>unexpected tag name </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tag_name'>tag_name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> |
| <span class='kw'>end</span> |
| |
| <span class='ivar'>@element</span> <span class='op'>=</span> <span class='id identifier rubyid_element'>element</span> |
| <span class='ivar'>@multi</span> <span class='op'>=</span> <span class='op'>!</span><span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>false</span><span class='tstring_end'>"</span></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_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_attribute'>attribute</span><span class='lparen'>(</span><span class='symbol'>:multiple</span><span class='rparen'>)</span><span class='rparen'>)</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="deselect_all-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>deselect_all</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Deselect all selected options. Only valid if the element supports multiple |
| selections.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Raises:</p> |
| <ul class="raise"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt><span class='object_link'><a href="../Error/UnsupportedOperationError.html" title="Selenium::WebDriver::Error::UnsupportedOperationError (class)">Error::UnsupportedOperationError</a></span></tt>)</span> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>if the element does not support multiple selections.</p> |
| </div> |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 138 |
| 139 |
| 140 |
| 141 |
| 142 |
| 143 |
| 144</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 138</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_deselect_all'>deselect_all</span> |
| <span class='kw'>unless</span> <span class='id identifier rubyid_multiple?'>multiple?</span> |
| <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Error</span><span class='op'>::</span><span class='const'>UnsupportedOperationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>you may only deselect all options of a multi-select</span><span class='tstring_end'>'</span></span> |
| <span class='kw'>end</span> |
| |
| <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_deselect_option'>deselect_option</span> <span class='id identifier rubyid_e'>e</span> <span class='rbrace'>}</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="deselect_by-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>deselect_by</strong>(how, what) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Deselect options by visible text, index or value.</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>:text</tt>, <tt>:index</tt>, <tt>:value</tt>)</span> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>How to find the option</p> |
| </div> |
| |
| </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> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>What value to find the option by.</p> |
| </div> |
| |
| </li> |
| |
| </ul> |
| |
| |
| <p class="tag_title">See Also:</p> |
| <ul class="see"> |
| |
| <li><span class='object_link'><a href="#select_by-instance_method" title="Selenium::WebDriver::Support::Select#select_by (method)">#select_by</a></span></li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 105 |
| 106 |
| 107 |
| 108 |
| 109 |
| 110 |
| 111 |
| 112 |
| 113 |
| 114 |
| 115 |
| 116</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 105</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_deselect_by'>deselect_by</span><span class='lparen'>(</span><span class='id identifier rubyid_how'>how</span><span class='comma'>,</span> <span class='id identifier rubyid_what'>what</span><span class='rparen'>)</span> |
| <span class='kw'>case</span> <span class='id identifier rubyid_how'>how</span> |
| <span class='kw'>when</span> <span class='symbol'>:text</span> |
| <span class='id identifier rubyid_deselect_by_text'>deselect_by_text</span> <span class='id identifier rubyid_what'>what</span> |
| <span class='kw'>when</span> <span class='symbol'>:value</span> |
| <span class='id identifier rubyid_deselect_by_value'>deselect_by_value</span> <span class='id identifier rubyid_what'>what</span> |
| <span class='kw'>when</span> <span class='symbol'>:index</span> |
| <span class='id identifier rubyid_deselect_by_index'>deselect_by_index</span> <span class='id identifier rubyid_what'>what</span> |
| <span class='kw'>else</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'>"</span><span class='tstring_content'>can't deselect options 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'>"</span></span> |
| <span class='kw'>end</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="first_selected_option-instance_method"> |
| |
| - (<tt><span class='object_link'><a href="../Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span></tt>) <strong>first_selected_option</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Get the first selected option in this select 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)">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> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>if no options are selected</p> |
| </div> |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 58 |
| 59 |
| 60 |
| 61</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 58</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_first_selected_option'>first_selected_option</span> |
| <span class='id identifier rubyid_option'>option</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_selected?'>selected?</span> <span class='rbrace'>}</span> |
| <span class='id identifier rubyid_option'>option</span> <span class='kw'>or</span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Error</span><span class='op'>::</span><span class='const'>NoSuchElementError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>no options are selected</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="multiple?-instance_method"> |
| |
| - (<tt>Boolean</tt>) <strong>multiple?</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Does this select element support selecting multiple options?</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"> |
| |
| |
| 27 |
| 28 |
| 29</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 27</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_multiple?'>multiple?</span> |
| <span class='ivar'>@multi</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="options-instance_method"> |
| |
| - (<tt>Array<<span class='object_link'><a href="../Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span>></tt>) <strong>options</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Get all options for this select element</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Array<<span class='object_link'><a href="../Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span>></tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 37 |
| 38 |
| 39</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 37</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span> |
| <span class='ivar'>@element</span><span class='period'>.</span><span class='id identifier rubyid_find_elements'>find_elements</span> <span class='symbol'>:tag_name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>option</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="select_all-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>select_all</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Select all unselected options. Only valid if the element supports multiple |
| selections.</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Raises:</p> |
| <ul class="raise"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt><span class='object_link'><a href="../Error/UnsupportedOperationError.html" title="Selenium::WebDriver::Error::UnsupportedOperationError (class)">Error::UnsupportedOperationError</a></span></tt>)</span> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>if the element does not support multiple selections.</p> |
| </div> |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 124 |
| 125 |
| 126 |
| 127 |
| 128 |
| 129 |
| 130</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 124</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_select_all'>select_all</span> |
| <span class='kw'>unless</span> <span class='id identifier rubyid_multiple?'>multiple?</span> |
| <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Error</span><span class='op'>::</span><span class='const'>UnsupportedOperationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>you may only select all options of a multi-select</span><span class='tstring_end'>'</span></span> |
| <span class='kw'>end</span> |
| |
| <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_select_option'>select_option</span> <span class='id identifier rubyid_e'>e</span> <span class='rbrace'>}</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="select_by-instance_method"> |
| |
| - (<tt>Object</tt>) <strong>select_by</strong>(how, what) |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Select options by visible text, index or value.</p> |
| |
| <p>When selecting by :text, selects options that display text matching the |
| argument. That is, when given "Bar" this would select an option like:</p> |
| |
| <pre class="code ruby"><code><option value="foo">Bar</option></code></pre> |
| |
| <p>When slecting by :value, selects all options that have a value matching the |
| argument. That is, when given "foo" this would select an option like:</p> |
| |
| <pre class="code ruby"><code><option value="foo">Bar</option></code></pre> |
| |
| <p>When selecting by :index, selects the option at the given index. This is |
| done by examining the "index" attribute of an element, and not merely by |
| counting.</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>:text</tt>, <tt>:index</tt>, <tt>:value</tt>)</span> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>How to find the option</p> |
| </div> |
| |
| </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> |
| |
| |
| |
| — |
| <div class='inline'> |
| <p>What value to find the option by.</p> |
| </div> |
| |
| </li> |
| |
| </ul> |
| |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 83 |
| 84 |
| 85 |
| 86 |
| 87 |
| 88 |
| 89 |
| 90 |
| 91 |
| 92 |
| 93 |
| 94</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 83</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_select_by'>select_by</span><span class='lparen'>(</span><span class='id identifier rubyid_how'>how</span><span class='comma'>,</span> <span class='id identifier rubyid_what'>what</span><span class='rparen'>)</span> |
| <span class='kw'>case</span> <span class='id identifier rubyid_how'>how</span> |
| <span class='kw'>when</span> <span class='symbol'>:text</span> |
| <span class='id identifier rubyid_select_by_text'>select_by_text</span> <span class='id identifier rubyid_what'>what</span> |
| <span class='kw'>when</span> <span class='symbol'>:index</span> |
| <span class='id identifier rubyid_select_by_index'>select_by_index</span> <span class='id identifier rubyid_what'>what</span> |
| <span class='kw'>when</span> <span class='symbol'>:value</span> |
| <span class='id identifier rubyid_select_by_value'>select_by_value</span> <span class='id identifier rubyid_what'>what</span> |
| <span class='kw'>else</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'>"</span><span class='tstring_content'>can't select options 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'>"</span></span> |
| <span class='kw'>end</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="method_details "> |
| <h3 class="signature " id="selected_options-instance_method"> |
| |
| - (<tt>Array<<span class='object_link'><a href="../Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span>></tt>) <strong>selected_options</strong> |
| |
| |
| |
| |
| |
| </h3><div class="docstring"> |
| <div class="discussion"> |
| |
| <p>Get all selected options for this select element</p> |
| |
| |
| </div> |
| </div> |
| <div class="tags"> |
| |
| <p class="tag_title">Returns:</p> |
| <ul class="return"> |
| |
| <li> |
| |
| |
| <span class='type'>(<tt>Array<<span class='object_link'><a href="../Element.html" title="Selenium::WebDriver::Element (class)">Element</a></span>></tt>)</span> |
| |
| |
| |
| </li> |
| |
| </ul> |
| |
| </div><table class="source_code"> |
| <tr> |
| <td> |
| <pre class="lines"> |
| |
| |
| 47 |
| 48 |
| 49</pre> |
| </td> |
| <td> |
| <pre class="code"><span class="info file"># File 'rb/lib/selenium/webdriver/support/select.rb', line 47</span> |
| |
| <span class='kw'>def</span> <span class='id identifier rubyid_selected_options'>selected_options</span> |
| <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_selected?'>selected?</span> <span class='rbrace'>}</span> |
| <span class='kw'>end</span></pre> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| </div> |
| |
| </div> |
| |
| <div id="footer"> |
| Generated on Thu Jul 19 12:32:29 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> |