lib/fluent/platform_watir/platform_object.rb in fluent-0.5.0 vs lib/fluent/platform_watir/platform_object.rb in fluent-0.6.0
- old
+ new
@@ -88,26 +88,38 @@
def link(locator)
reference_web_element('link(locator)', WebElements::Link, locator)
end
+ def links(locator)
+ reference_web_elements('links(locator)', WebElements::Link, locator)
+ end
+
def link_click(locator)
access_web_element('link(locator).click', locator)
end
def button(locator)
reference_web_element('button(locator)', WebElements::Button, locator)
end
+ def buttons(locator)
+ reference_web_elements('buttons(locator)', WebElements::Button, locator)
+ end
+
def button_click(locator)
access_web_element('button(locator).click', locator)
end
def text_field(locator)
reference_web_element('text_field(locator)', WebElements::TextField, locator)
end
+ def text_fields(locator)
+ reference_web_elements('text_fields(locator)', WebElements::TextField, locator)
+ end
+
def text_field_set(locator, value)
access_web_element('text_field(locator).set(value)', locator, value)
end
def text_field_get(locator)
@@ -116,10 +128,14 @@
def text_area(locator)
reference_web_element('textarea(locator)', WebElements::TextArea, locator)
end
+ def text_areas(locator)
+ reference_web_elements('textareas(locator)', WebElements::TextArea, locator)
+ end
+
def text_area_set(locator, value)
access_web_element('textarea(locator).set(value)', locator, value)
end
def text_area_get(locator)
@@ -128,10 +144,16 @@
def checkbox(locator)
reference_web_element('checkbox(locator)', WebElements::CheckBox, locator)
end
+ def checkboxes(locator)
+ reference_web_elements('checkboxes(locator)', WebElements::CheckBox, locator)
+ end
+
+ alias_method :checkboxs, :checkboxes
+
def checkbox_check_state(locator)
access_web_element('checkbox(locator).set?', locator)
end
def checkbox_check(locator)
@@ -143,10 +165,14 @@
end
def select_list(locator)
reference_web_element('select_list(locator)', WebElements::SelectList, locator)
end
+
+ def select_lists(locator)
+ reference_web_elements('select_lists(locator)', WebElements::SelectList, locator)
+ end
def select_list_get_selected(locator)
access_web_element('select_list(locator).selected_options[0].text', locator)
end
@@ -159,10 +185,14 @@
end
def radio(locator)
reference_web_element('radio(locator)', WebElements::Radio, locator)
end
+
+ def radios(locator)
+ reference_web_elements('radios(locator)', WebElements::Radio, locator)
+ end
def radio_select(locator)
access_web_element('radio(locator).set', locator)
end
@@ -171,143 +201,227 @@
end
def paragraph(locator)
reference_web_element('p(locator)', WebElements::Paragraph, locator)
end
+
+ def paragraphs(locator)
+ reference_web_elements('ps(locator)', WebElements::Paragraph, locator)
+ end
def paragraph_text(locator)
access_web_element('p(locator).text', locator)
end
def div(locator)
reference_web_element('div(locator)', WebElements::Div, locator)
end
+ def divs(locator)
+ reference_web_elements('divs(locator)', WebElements::Div, locator)
+ end
+
def div_text(locator)
access_web_element('div(locator).text', locator)
end
def span(locator)
reference_web_element('span(locator)', WebElements::Span, locator)
end
-
+
+ def spans(locator)
+ reference_web_elements('spans(locator)', WebElements::Span, locator)
+ end
+
def span_text(locator)
access_web_element('span(locator).text', locator)
end
def ordered_list(locator)
reference_web_element('ol(locator)', WebElements::OrderedList, locator)
end
+
+ def ordered_lists(locator)
+ reference_web_elements('ols(locator)', WebElements::OrderedList, locator)
+ end
def ordered_list_text(locator)
access_web_element('ol(locator).text', locator)
end
def unordered_list(locator)
reference_web_element('ul(locator)', WebElements::UnorderedList, locator)
end
-
+
+ def unordered_lists(locator)
+ reference_web_elements('uls(locator)', WebElements::UnorderedList, locator)
+ end
+
def unordered_list_text(locator)
access_web_element('ul(locator).text', locator)
end
def list_item(locator)
reference_web_element('li(locator)', WebElements::ListItem, locator)
end
+ def list_items(locator)
+ reference_web_elements('lis(locator)', WebElements::ListItem, locator)
+ end
+
def list_item_text(locator)
access_web_element('li(locator).text', locator)
end
def table(locator)
reference_web_element('table(locator)', WebElements::Table, locator)
end
-
+
+ def tables(locator)
+ reference_web_elements('tables(locator)', WebElements::Table, locator)
+ end
+
def table_text(locator)
access_web_element('table(locator).text', locator)
end
def cell(locator)
reference_web_element('td(locator)', WebElements::Cell, locator)
end
-
+
+ def cells(locator)
+ reference_web_elements('tds(locator)', WebElements::Cell, locator)
+ end
+
def cell_text(locator)
access_web_element('td(locator).text', locator)
end
def label(locator)
reference_web_element('label(locator)', WebElements::Label, locator)
end
+ def labels(locator)
+ reference_web_elements('labels(locator)', WebElements::Label, locator)
+ end
+
def label_text(locator)
access_web_element('label(locator).text', locator)
end
def hidden(locator)
reference_web_element('hidden(locator)', WebElements::Hidden, locator)
end
+ def hiddens(locator)
+ reference_web_elements('hiddens(locator)', WebElements::Hidden, locator)
+ end
+
def hidden_value(locator)
access_web_element('hidden(locator).value', locator)
end
def h1(locator)
reference_web_element('h1(locator)', WebElements::Heading, locator)
end
+
+ def h1s(locator)
+ reference_web_elements('h1s(locator)', WebElements::Heading, locator)
+ end
def h1_text(locator)
access_web_element('h1(locator).text', locator)
end
def h2(locator)
reference_web_element('h2(locator)', WebElements::Heading, locator)
end
+ def h2s(locator)
+ reference_web_elements('h2s(locator)', WebElements::Heading, locator)
+ end
+
def h2_text(locator)
access_web_element('h2(locator).text', locator)
end
def h3(locator)
reference_web_element('h3(locator)', WebElements::Heading, locator)
end
+ def h3s(locator)
+ reference_web_elements('h3s(locator)', WebElements::Heading, locator)
+ end
+
def h3_text(locator)
access_web_element('h3(locator).text', locator)
end
def h4(locator)
reference_web_element('h4(locator)', WebElements::Heading, locator)
end
+ def h4s(locator)
+ reference_web_elements('h4s(locator)', WebElements::Heading, locator)
+ end
+
def h4_text(locator)
access_web_element('h4(locator).text', locator)
end
def h5(locator)
reference_web_element('h5(locator)', WebElements::Heading, locator)
end
+ def h5s(locator)
+ reference_web_elements('h5s(locator)', WebElements::Heading, locator)
+ end
+
def h5_text(locator)
access_web_element('h5(locator).text', locator)
end
def h6(locator)
reference_web_element('h6(locator)', WebElements::Heading, locator)
end
+ def h6s(locator)
+ reference_web_elements('h6s(locator)', WebElements::Heading, locator)
+ end
+
def h6_text(locator)
access_web_element('h6(locator).text', locator)
end
def form(locator)
reference_web_element('form(locator)', WebElements::Form, locator)
end
+ def forms(locator)
+ reference_web_elements('forms(locator)', WebElements::Form, locator)
+ end
+
def image(locator)
reference_web_element('image(locator)', WebElements::Image, locator)
end
+ def images(locator)
+ reference_web_elements('images(locator)', WebElements::Image, locator)
+ end
+
+ def image_action(locator, action)
+ access_web_element("image(locator).#{action}", locator)
+ end
+
+ def image_get_source(locator)
+ access_web_element("image(locator).attribute_value('src')", locator)
+ end
+
+ def image_get_alt_text(locator)
+ access_web_element("image(locator).attribute_value('alt')", locator)
+ end
+
alias_method :radio_button, :radio
alias_method :textarea, :text_area
alias_method :textfield, :text_field
alias_method :a, :link
alias_method :p, :paragraph
@@ -326,9 +440,17 @@
# @return [Object] the web object identified by the action
def reference_web_element(action, object, locator)
encloser = locator.delete(:frame)
element_object = driver.instance_eval("#{enclosed_by(encloser)}#{action}")
object.new(element_object, :platform => :watir_webdriver)
+ end
+
+ def reference_web_elements(action, object, locator)
+ encloser = locator.delete(:frame)
+ element_objects = driver.instance_eval("#{enclosed_by(encloser)}#{action}")
+ element_objects.map do |element|
+ object.new(element, :platform => :watir_webdriver)
+ end
end
# This method is called by any platform methods that require accessing
# a web object with the intent of manipulating it or getting information
# from it.
\ No newline at end of file