Module: SeleniumPlus::Elements::DList
- Included in:
- Selenium::WebDriver::Element
- Defined in:
- lib/selenium_plus/selenium/dlist.rb
Instance Method Summary collapse
-
#dd_raw ⇒ Object
Raw dd elements of the definition list.
-
#dd_text ⇒ Hash
dd elements text of the definition list.
-
#dlist_hashes ⇒ Hash
Converts this table into an Array of Hash where the keys of each Hash are the headers in the table.
-
#dt_raw ⇒ Object
Raw dt elements of the definition list.
-
#dt_text ⇒ Hash
dt elements text of the definition list.
Instance Method Details
#dd_raw ⇒ Object
Raw dd elements of the definition list
14 15 16 |
# File 'lib/selenium_plus/selenium/dlist.rb', line 14 def dd_raw self.find_all(:css, 'dd') end |
#dd_text ⇒ Hash
dd elements text of the definition list
Examples:
A html definition list:
<dl>
<dt>Title 1</dt>
<dd>Description 1</dd>
<dt>Title 2</dt>
<dd>Description 2</dd>
</dl>
Gets converted into the following:
# => [Description 1', 'Description 2]
52 53 54 |
# File 'lib/selenium_plus/selenium/dlist.rb', line 52 def dd_text dd_raw.map{ |el| el.text} end |
#dlist_hashes ⇒ Hash
Converts this table into an Array of Hash where the keys of each Hash are the headers in the table.
Examples:
A html definition list:
<dl>
<dt>Title 1</dt>
<dd>Description 1</dd>
<dt>Title 2</dt>
<dd>Description 2</dd>
</dl>
Gets converted into the following:
# => {'Title 1' => 'Description 1', 'Title 2' => 'Description 2 }
71 72 73 |
# File 'lib/selenium_plus/selenium/dlist.rb', line 71 def dlist_hashes Hash[*dt_text.zip(dd_text).flatten] end |
#dt_raw ⇒ Object
Raw dt elements of the definition list
7 8 9 |
# File 'lib/selenium_plus/selenium/dlist.rb', line 7 def dt_raw self.find_all(:css, 'dt') end |
#dt_text ⇒ Hash
dt elements text of the definition list
Examples:
A html definition list:
<dl>
<dt>Title 1</dt>
<dd>Description 1</dd>
<dt>Title 2</dt>
<dd>Description 2</dd>
</dl>
Gets converted into the following:
# => ['Title 1', 'Title 2']
33 34 35 |
# File 'lib/selenium_plus/selenium/dlist.rb', line 33 def dt_text dt_raw.map{ |el| el.text} end |