Class: PageObject::Platforms::Watir::PageObject
- Inherits:
-
Object
- Object
- PageObject::Platforms::Watir::PageObject
- Defined in:
- lib/page-object/platforms/watir/page_object.rb
Overview
Watir implementation of the page object platform driver. You should not use the class directly. Instead you should include the PageObject module in your page object and use the methods dynamically added from the PageObject::Accessors module.
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
Class Method Summary collapse
Instance Method Summary collapse
-
#alert(frame = nil, &block) ⇒ Object
platform method to handle an alert popup See PageObject#alert.
-
#area_for(identifier) ⇒ Object
platform method to retrieve an area element.
-
#areas_for(identifier) ⇒ Object
platform method to retrieve an array of area elements.
-
#attach_to_window(identifier, &block) ⇒ Object
platform method to handle attaching to a running window See PageObject#attach_to_window.
-
#audio_for(identifier) ⇒ Object
platform method to retrieve an audio element.
-
#audios_for(identifier) ⇒ Object
platform method to retrieve an array of audio elements.
-
#b_for(identifier) ⇒ Object
platform method to retrieve the b element See PageObject::Accessors#b.
-
#b_text_for(identifier) ⇒ Object
platform method to retrieve the text for a b See PageObject::Accessors#b.
-
#back ⇒ Object
platform method to go back to the previous page See PageObject#back.
-
#bs_for(identifier) ⇒ Object
platform method to retrieve an array of bs.
-
#button_for(identifier) ⇒ Object
platform method to retrieve a button element See PageObject::Accessors#button.
-
#buttons_for(identifier) ⇒ Object
platform method to retrieve an array of button elements.
-
#canvas_for(identifier) ⇒ Object
platform method to retrieve a canvas element.
-
#canvass_for(identifier) ⇒ Object
platform method to retrieve an array of canvas elements.
-
#cell_for(identifier) ⇒ Object
platform method to retrieve a table cell element See PageObject::Accessors#cell.
-
#cell_text_for(identifier) ⇒ Object
platform method to retrieve the text from a table cell See PageObject::Accessors#cell.
-
#cells_for(identifier) ⇒ Object
platform method to retrieve an array of table cell elements.
-
#check_checkbox(identifier) ⇒ Object
platform method to check a checkbox See PageObject::Accessors#checkbox.
-
#checkbox_checked?(identifier) ⇒ Boolean
platform method to determine if a checkbox is checked See PageObject::Accessors#checkbox.
-
#checkbox_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::CheckBox element See PageObject::Accessors#checkbox.
-
#checkboxs_for(identifier) ⇒ Object
platform method to retrieve an array of checkbox elements.
-
#clear_cookies ⇒ Object
platform method to clear the cookies from the browser See PageObject#clear_cookies.
-
#click_area_for(identifier) ⇒ Object
platform method to click on an area.
-
#click_button_for(identifier) ⇒ Object
platform method to click a button See PageObject::Accessors#button.
-
#click_link_for(identifier) ⇒ Object
platform method to click a link See PageObject::Accessors#link.
-
#confirm(response, frame = nil, &block) ⇒ Object
platform method to handle a confirm popup See PageObject#confirm.
-
#current_url ⇒ Object
platform method to get the current url See PageObject#current_url.
-
#date_field_for(identifier) ⇒ Object
platform method to retrieve a date field element See PageObject::Accessors#date_field.
-
#date_field_value_for(identifier) ⇒ Object
platform method to get the value stored in a date field See PageObject::Accessors#date_field.
-
#date_field_value_set(identifier, value) ⇒ Object
platform method to set the value for a date field See PageObject::Accessors#date_field.
-
#date_fields_for(identifier) ⇒ Object
platform method to retrieve an array of date field elements.
-
#div_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Div element See PageObject::Accessors#div.
-
#div_text_for(identifier) ⇒ Object
platform method to return the text for a div See PageObject::Accessors#div.
-
#divs_for(identifier) ⇒ Object
platform method to retrieve an array of div elements.
-
#element_for(tag, identifier) ⇒ Object
platform method to return a PageObject::Elements::Element element See PageObject::Accessors#element.
- #element_with_focus ⇒ Object
-
#elements_for(tag, identifier) ⇒ Object
platform method to return an array of PageObject::Elements::Element elements See PageObject::Accessors#element.
-
#execute_script(script, *args) ⇒ Object
platform method to execute javascript on the browser See PageObject#execute_script.
-
#file_field_for(identifier) ⇒ Object
platform method to retrieve a file_field element See PageObject::Accessors#file_field.
-
#file_field_value_set(identifier, value) ⇒ Object
platform method to set the file on a file_field element See PageObject::Accessors#file_field.
-
#file_fields_for(identifier) ⇒ Object
platform method to retrieve an array of file field elements.
-
#form_for(identifier) ⇒ Object
platform method to retrieve a form element See PageObject::Accessors#form.
-
#forms_for(identifier) ⇒ Object
platform method to retrieve an array of forms.
-
#forward ⇒ Object
platform method to go forward to the next page See PageObject#forward.
-
#h1_for(identifier) ⇒ Object
platform method to retrieve the h1 element See PageObject::Accessors#h1.
-
#h1_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h1 See PageObject::Accessors#h1.
-
#h1s_for(identifier) ⇒ Object
platform method to retrieve an array of h1s.
-
#h2_for(identifier) ⇒ Object
platform method to retrieve the h2 element See PageObject::Accessors#h2.
-
#h2_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h2 See PageObject::Accessors#h2.
-
#h2s_for(identifier) ⇒ Object
platform method to retrieve an array of h2s.
-
#h3_for(identifier) ⇒ Object
platform method to retrieve the h3 element See PageObject::Accessors#h3.
-
#h3_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h3 See PageObject::Accessors#h3.
-
#h3s_for(identifier) ⇒ Object
platform method to retrieve an array of h3s.
-
#h4_for(identifier) ⇒ Object
platform method to retrieve the h4 element See PageObject::Accessors#h4.
-
#h4_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h4 See PageObject::Accessors#h4.
-
#h4s_for(identifier) ⇒ Object
platform method to retrieve an array of h4s.
-
#h5_for(identifier) ⇒ Object
platform method to retrieve the h5 element See PageObject::Accessors#h5.
-
#h5_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h5 See PageObject::Accessors#h5.
-
#h5s_for(identifier) ⇒ Object
platform method to retrieve an array of h5s.
-
#h6_for(identifier) ⇒ Object
platform method to retrieve the h6 element See PageObject::Accessors#h6.
-
#h6_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h6 See PageObject::Accessors#h6.
-
#h6s_for(identifier) ⇒ Object
platform method to retrieve an array of h6s.
-
#hidden_field_for(identifier) ⇒ Object
platform method to retrieve a hidden field element See PageObject::Accessors#hidden_field.
-
#hidden_field_value_for(identifier) ⇒ Object
platform method to get the value stored in a hidden field See PageObject::Accessors#hidden_field.
-
#hidden_fields_for(identifier) ⇒ Object
platform method to retrieve an array of hidden field elements.
-
#html ⇒ Object
platform method to retrieve the html for the current page See PageObject#html.
-
#i_for(identifier) ⇒ Object
platform method to retrieve the i element See PageObject::Accessors#i.
-
#i_text_for(identifier) ⇒ Object
platform method to retrieve the text for a i See PageObject::Accessors#i.
-
#image_for(identifier) ⇒ Object
platform method to retrieve an image element See PageObject::Accessors#image.
-
#image_loaded_for(identifier) ⇒ Object
platform method to retrieve load status of an image element See PageObject::Accessors#image.
-
#images_for(identifier) ⇒ Object
platform method to retrieve an array of image elements.
-
#in_frame(identifier, frame = nil, &block) ⇒ Object
platform method to switch to a frame and execute a block See PageObject#in_frame.
-
#in_iframe(identifier, frame = nil, &block) ⇒ Object
platform method to switch to an iframe and execute a block See PageObject#in_frame.
-
#initialize(browser) ⇒ PageObject
constructor
A new instance of PageObject.
-
#is_for(identifier) ⇒ Object
platform method to retrieve an array of is.
-
#label_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Label element See PageObject::Accessors#label.
-
#label_text_for(identifier) ⇒ Object
platform method to return the text for a label See PageObject::Accessors#label.
-
#labels_for(identifier) ⇒ Object
platform method to retrieve an array of label elements.
-
#link_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Link object see PageObject::Accessors#link.
-
#links_for(identifier) ⇒ Object
platform method to retrieve an array of link elements.
-
#list_item_for(identifier) ⇒ Object
platform method to retrieve a list item element See PageObject::Accessors#list_item.
-
#list_item_text_for(identifier) ⇒ Object
platform method to retrieve the text from a list item See PageObject::Accessors#list_item.
-
#list_items_for(identifier) ⇒ Object
platform method to retrieve an array of list items.
-
#navigate_to(url) ⇒ Object
platform method to navigate to a provided url See PageObject#navigate_to.
-
#ordered_list_for(identifier) ⇒ Object
platform method to retrieve an ordered list element See PageObject::Accessors#ordered_list.
-
#ordered_list_text_for(identifier) ⇒ Object
platform method to retrieve the text from an ordered list See PageObject::Accessors#ordered_list.
-
#ordered_lists_for(identifier) ⇒ Object
platform method to retrieve an array of ordered lists.
-
#page_for(identifier, page_class) ⇒ Object
platform method to return a PageObject rooted at an element See PageObject::Accessors#page_section.
-
#pages_for(identifier, page_class) ⇒ Object
platform method to return a collection of PageObjects rooted at elements See PageObject::Accessors#page_sections.
-
#paragraph_for(identifier) ⇒ Object
platform method to retrieve the paragraph element See PageObject::Accessors#paragraph.
-
#paragraph_text_for(identifier) ⇒ Object
platform method to retrieve the text for a paragraph See PageObject::Accessors#paragraph.
-
#paragraphs_for(identifier) ⇒ Object
platform method to retrieve an array of paragraph elements.
-
#prompt(answer, frame = nil, &block) ⇒ Object
platform method to handle a prompt popup See PageObject#prompt.
-
#radio_button_for(identifier) ⇒ Object
platform method to return a PageObject::Eements::RadioButton element See PageObject::Accessors#radio_button.
-
#radio_buttons_for(identifier) ⇒ Object
platform method to retrieve an array of radio button elements.
-
#radio_selected?(identifier) ⇒ Boolean
platform method to determine if a radio button is selected See PageObject::Accessors#radio_button.
-
#refresh ⇒ Object
platform method to refresh the page See PageObject#refresh.
-
#row_for(identifier) ⇒ Object
platform method to retrieve a table row element See PageObject::Accessors#row.
-
#row_text_for(identifier) ⇒ Object
platform method to retrieve the text from a table row See PageObject::Accessors#row.
-
#rows_for(identifier) ⇒ Object
platform method to retrieve an array of table row elements.
-
#save_screenshot(file_name) ⇒ Object
platform method to save the current screenshot to a file See PageObject#save_screenshot.
-
#select_list_for(identifier) ⇒ Object
platform method to return the select list element See PageObject::Accessors#select_list.
-
#select_list_value_for(identifier) ⇒ Object
platform method to get the currently selected value from a select list See PageObject::Accessors#select_list.
-
#select_list_value_set(identifier, value) ⇒ Object
platform method to select a value from a select list See PageObject::Accessors#select_list.
-
#select_lists_for(identifier) ⇒ Object
platform method to retrieve an array of select_list elements.
-
#select_radio(identifier) ⇒ Object
platform method to select a radio button See PageObject::Accessors#radio_button.
-
#span_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Span element See PageObject::Accessors#span.
-
#span_text_for(identifier) ⇒ Object
platform method to return the text for a span See PageObject::Accessors#span.
-
#spans_for(identifier) ⇒ Object
platform method to retrieve an array of span elements.
-
#svg_for(identifier) ⇒ Object
platform method to return a svg element.
-
#svgs_for(identifier) ⇒ Object
platform method to return an array of svg elements.
-
#table_for(identifier) ⇒ Object
platform method to retrieve a table element See PageObject::Accessors#table.
-
#table_text_for(identifier) ⇒ Object
platform method to return the text for a table See PageObject::Accessors#table.
-
#tables_for(identifier) ⇒ Object
platform method to retrieve an array of table elements.
-
#text ⇒ Object
platform method to retrieve the text from the current page See PageObject#text.
-
#text_area_for(identifier) ⇒ Object
platform method to get the text area element See PageObject::Accessors#text_area.
-
#text_area_value_for(identifier) ⇒ Object
platform method to get the text from a textarea See PageObject::Accessors#text_area.
-
#text_area_value_set(identifier, value) ⇒ Object
platform method to set text in a textarea See PageObject::Accessors#text_area.
-
#text_areas_for(identifier) ⇒ Object
platform method to retrieve an array of textarea elements.
-
#text_field_for(identifier) ⇒ Object
platform method to retrieve a text field element See PageObject::Accessors#text_field.
-
#text_field_value_for(identifier) ⇒ Object
platform method to get the value stored in a text field See PageObject::Accessors#text_field.
-
#text_field_value_set(identifier, value) ⇒ Object
platform method to set the value for a text field See PageObject::Accessors#text_field.
-
#text_fields_for(identifier) ⇒ Object
platform method to retrieve an array of text field elements.
-
#title ⇒ Object
platform method to retrieve the title for the current page See PageObject#title.
-
#uncheck_checkbox(identifier) ⇒ Object
platform method to uncheck a checkbox See PageObject::Accessors#checkbox.
-
#unordered_list_for(identifier) ⇒ Object
platform method to retrieve an unordered list element See PageObject::Accessors#unordered_list.
-
#unordered_list_text_for(identifier) ⇒ Object
platform method to retrieve the text from an unordered list See PageObject::Accessors#unordered_list.
-
#unordered_lists_for(identifier) ⇒ Object
platform method to retrieve an array of unordered lists.
-
#video_for(identifier) ⇒ Object
platform method to retrieve a video element.
-
#videos_for(identifier) ⇒ Object
platform method to retrieve an array of video elements.
-
#wait_until(timeout, message = nil, &block) ⇒ Object
platform method to wait for a block to return true See PageObject#wait_until.
Constructor Details
#initialize(browser) ⇒ PageObject
Returns a new instance of PageObject.
21 22 23 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 21 def initialize(browser) @browser = browser end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
14 15 16 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 14 def browser @browser end |
Class Method Details
.define_widget_accessors(widget_tag, widget_class, base_element_tag) ⇒ Object
16 17 18 19 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 16 def self.(, , base_element_tag) (base_element_tag, , ) (base_element_tag, , ) end |
Instance Method Details
#alert(frame = nil, &block) ⇒ Object
platform method to handle an alert popup See PageObject#alert
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 76 def alert(frame=nil, &block) switch_to_frame(frame) yield value = nil if @browser.alert.exists? value = @browser.alert.text @browser.alert.ok end switch_to_default_content(frame) value end |
#area_for(identifier) ⇒ Object
platform method to retrieve an area element
920 921 922 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 920 def area_for(identifier) find_watir_element("area(identifier)", Elements::Area, identifier, 'area') end |
#areas_for(identifier) ⇒ Object
platform method to retrieve an array of area elements
927 928 929 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 927 def areas_for(identifier) find_watir_elements("areas(identifier)", Elements::Area, identifier, 'area') end |
#attach_to_window(identifier, &block) ⇒ Object
platform method to handle attaching to a running window See PageObject#attach_to_window
130 131 132 133 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 130 def attach_to_window(identifier, &block) win_id = {identifier.keys.first => /#{Regexp.escape(identifier.values.first)}/} @browser.window(win_id).use &block end |
#audio_for(identifier) ⇒ Object
platform method to retrieve an audio element
948 949 950 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 948 def audio_for(identifier) find_watir_element("audio(identifier)", Elements::Audio, identifier, 'audio') end |
#audios_for(identifier) ⇒ Object
platform method to retrieve an array of audio elements
955 956 957 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 955 def audios_for(identifier) find_watir_elements("audios(identifier)", Elements::Audio, identifier, 'audio') end |
#b_for(identifier) ⇒ Object
platform method to retrieve the b element See PageObject::Accessors#b
1031 1032 1033 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1031 def b_for(identifier) find_watir_element("b(identifier)", Elements::Bold, identifier, 'b') end |
#b_text_for(identifier) ⇒ Object
platform method to retrieve the text for a b See PageObject::Accessors#b
1023 1024 1025 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1023 def b_text_for(identifier) process_watir_call("b(identifier).text", Elements::Bold, identifier, nil, 'b') end |
#back ⇒ Object
platform method to go back to the previous page See PageObject#back
174 175 176 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 174 def back @browser.back end |
#bs_for(identifier) ⇒ Object
platform method to retrieve an array of bs
1038 1039 1040 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1038 def bs_for(identifier) find_watir_elements("bs(identifier)", Elements::Bold, identifier, 'b') end |
#button_for(identifier) ⇒ Object
platform method to retrieve a button element See PageObject::Accessors#button
510 511 512 513 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 510 def (identifier) call = "button(identifier)" find_watir_element(call, Elements::Button, identifier) end |
#buttons_for(identifier) ⇒ Object
platform method to retrieve an array of button elements
518 519 520 521 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 518 def (identifier) call = "buttons(identifier)" find_watir_elements(call, Elements::Button, identifier) end |
#canvas_for(identifier) ⇒ Object
platform method to retrieve a canvas element
934 935 936 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 934 def canvas_for(identifier) find_watir_element("canvas(identifier)", Elements::Canvas, identifier, 'canvas') end |
#canvass_for(identifier) ⇒ Object
platform method to retrieve an array of canvas elements
941 942 943 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 941 def canvass_for(identifier) find_watir_elements("canvases(identifier)", Elements::Canvas, identifier, 'canvas') end |
#cell_for(identifier) ⇒ Object
platform method to retrieve a table cell element See PageObject::Accessors#cell
559 560 561 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 559 def cell_for(identifier) find_watir_element("td(identifier)", Elements::TableCell, identifier, 'td') end |
#cell_text_for(identifier) ⇒ Object
platform method to retrieve the text from a table cell See PageObject::Accessors#cell
550 551 552 553 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 550 def cell_text_for(identifier) process_watir_call("td(identifier).text", Elements::TableCell, identifier, nil, 'td') end |
#cells_for(identifier) ⇒ Object
platform method to retrieve an array of table cell elements
566 567 568 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 566 def cells_for(identifier) find_watir_elements("tds(identifier)", Elements::TableCell, identifier, 'td') end |
#check_checkbox(identifier) ⇒ Object
platform method to check a checkbox See PageObject::Accessors#checkbox
385 386 387 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 385 def check_checkbox(identifier) process_watir_call("checkbox(identifier).set", Elements::CheckBox, identifier) end |
#checkbox_checked?(identifier) ⇒ Boolean
platform method to determine if a checkbox is checked See PageObject::Accessors#checkbox
401 402 403 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 401 def checkbox_checked?(identifier) process_watir_call("checkbox(identifier).set?", Elements::CheckBox, identifier) end |
#checkbox_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::CheckBox element See PageObject::Accessors#checkbox
409 410 411 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 409 def checkbox_for(identifier) find_watir_element("checkbox(identifier)", Elements::CheckBox, identifier) end |
#checkboxs_for(identifier) ⇒ Object
platform method to retrieve an array of checkbox elements
416 417 418 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 416 def checkboxs_for(identifier) find_watir_elements("checkboxes(identifier)", Elements::CheckBox, identifier) end |
#clear_cookies ⇒ Object
platform method to clear the cookies from the browser See PageObject#clear_cookies
190 191 192 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 190 def @browser..clear end |
#click_area_for(identifier) ⇒ Object
platform method to click on an area
913 914 915 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 913 def click_area_for(identifier) process_watir_call("area(identifier).click", Elements::Area, identifier, nil, 'area') end |
#click_button_for(identifier) ⇒ Object
platform method to click a button See PageObject::Accessors#button
501 502 503 504 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 501 def (identifier) call = "button(identifier)" process_watir_call("#{call}.click", Elements::Button, identifier) end |
#click_link_for(identifier) ⇒ Object
platform method to click a link See PageObject::Accessors#link
359 360 361 362 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 359 def click_link_for(identifier) call = "link(identifier)" process_watir_call("#{call}.click if identifier", Elements::Link, identifier) end |
#confirm(response, frame = nil, &block) ⇒ Object
platform method to handle a confirm popup See PageObject#confirm
92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 92 def confirm(response, frame=nil, &block) switch_to_frame(frame) yield value = nil if @browser.alert.exists? value = @browser.alert.text response ? @browser.alert.ok : @browser.alert.close end switch_to_default_content(frame) value end |
#current_url ⇒ Object
platform method to get the current url See PageObject#current_url
37 38 39 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 37 def current_url @browser.url end |
#date_field_for(identifier) ⇒ Object
platform method to retrieve a date field element See PageObject::Accessors#date_field
254 255 256 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 254 def date_field_for(identifier) find_watir_element("date_field(identifier)", Elements::DateField, identifier) end |
#date_field_value_for(identifier) ⇒ Object
platform method to get the value stored in a date field See PageObject::Accessors#date_field
238 239 240 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 238 def date_field_value_for(identifier) process_watir_call("date_field(identifier).value", Elements::DateField, identifier) end |
#date_field_value_set(identifier, value) ⇒ Object
platform method to set the value for a date field See PageObject::Accessors#date_field
246 247 248 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 246 def date_field_value_set(identifier, value) process_watir_call("date_field(identifier).set(value)", Elements::DateField, identifier, value) end |
#date_fields_for(identifier) ⇒ Object
platform method to retrieve an array of date field elements
261 262 263 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 261 def date_fields_for(identifier) find_watir_elements("date_fields(identifier)", Elements::DateField, identifier) end |
#div_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Div element See PageObject::Accessors#div
463 464 465 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 463 def div_for(identifier) find_watir_element("div(identifier)", Elements::Div, identifier, 'div') end |
#div_text_for(identifier) ⇒ Object
platform method to return the text for a div See PageObject::Accessors#div
455 456 457 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 455 def div_text_for(identifier) process_watir_call("div(identifier).text", Elements::Div, identifier, nil, 'div') end |
#divs_for(identifier) ⇒ Object
platform method to retrieve an array of div elements
470 471 472 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 470 def divs_for(identifier) find_watir_elements("divs(identifier)", Elements::Div, identifier, 'div') end |
#element_for(tag, identifier) ⇒ Object
platform method to return a PageObject::Elements::Element element See PageObject::Accessors#element
977 978 979 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 977 def element_for(tag, identifier) find_watir_element("#{tag.to_s}(identifier)", Elements::Element, identifier, tag.to_s) end |
#element_with_focus ⇒ Object
135 136 137 138 139 140 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 135 def element_with_focus element = browser.execute_script("return document.activeElement") type = element.type.to_sym if element.tag_name.to_sym == :input cls = ::PageObject::Elements.element_class_for(element.tag_name, type) cls.new(element) end |
#elements_for(tag, identifier) ⇒ Object
platform method to return an array of PageObject::Elements::Element elements See PageObject::Accessors#element
985 986 987 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 985 def elements_for(tag, identifier) find_watir_elements("#{tag.to_s}s(identifier)", Elements::Element, identifier, tag.to_s) end |
#execute_script(script, *args) ⇒ Object
platform method to execute javascript on the browser See PageObject#execute_script
122 123 124 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 122 def execute_script(script, *args) @browser.execute_script(script, *args) end |
#file_field_for(identifier) ⇒ Object
platform method to retrieve a file_field element See PageObject::Accessors#file_field
899 900 901 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 899 def file_field_for(identifier) find_watir_element("file_field(identifier)", Elements::FileField, identifier) end |
#file_field_value_set(identifier, value) ⇒ Object
platform method to set the file on a file_field element See PageObject::Accessors#file_field
890 891 892 893 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 890 def file_field_value_set(identifier, value) process_watir_call("file_field(identifier).set(value)", Elements::FileField, identifier, value) end |
#file_fields_for(identifier) ⇒ Object
platform method to retrieve an array of file field elements
906 907 908 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 906 def file_fields_for(identifier) find_watir_elements("file_fields(identifier)", Elements::FileField, identifier) end |
#form_for(identifier) ⇒ Object
platform method to retrieve a form element See PageObject::Accessors#form
621 622 623 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 621 def form_for(identifier) find_watir_element("form(identifier)", Elements::Form, identifier) end |
#forms_for(identifier) ⇒ Object
platform method to retrieve an array of forms
628 629 630 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 628 def forms_for(identifier) find_watir_elements("forms(identifier)", Elements::Form, identifier) end |
#forward ⇒ Object
platform method to go forward to the next page See PageObject#forward
182 183 184 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 182 def forward @browser.forward end |
#h1_for(identifier) ⇒ Object
platform method to retrieve the h1 element See PageObject::Accessors#h1
713 714 715 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 713 def h1_for(identifier) find_watir_element("h1(identifier)", Elements::Heading, identifier, 'h1') end |
#h1_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h1 See PageObject::Accessors#h1
705 706 707 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 705 def h1_text_for(identifier) process_watir_call("h1(identifier).text", Elements::Heading, identifier, nil, 'h1') end |
#h1s_for(identifier) ⇒ Object
platform method to retrieve an array of h1s
720 721 722 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 720 def h1s_for(identifier) find_watir_elements("h1s(identifier)", Elements::Heading, identifier, 'h1') end |
#h2_for(identifier) ⇒ Object
platform method to retrieve the h2 element See PageObject::Accessors#h2
736 737 738 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 736 def h2_for(identifier) find_watir_element("h2(identifier)", Elements::Heading, identifier, 'h2') end |
#h2_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h2 See PageObject::Accessors#h2
728 729 730 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 728 def h2_text_for(identifier) process_watir_call("h2(identifier).text", Elements::Heading, identifier, nil, 'h2') end |
#h2s_for(identifier) ⇒ Object
platform method to retrieve an array of h2s
743 744 745 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 743 def h2s_for(identifier) find_watir_elements("h2s(identifier)", Elements::Heading, identifier, 'h2') end |
#h3_for(identifier) ⇒ Object
platform method to retrieve the h3 element See PageObject::Accessors#h3
759 760 761 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 759 def h3_for(identifier) find_watir_element("h3(identifier)", Elements::Heading, identifier, 'h3') end |
#h3_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h3 See PageObject::Accessors#h3
751 752 753 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 751 def h3_text_for(identifier) process_watir_call("h3(identifier).text", Elements::Heading, identifier, nil, 'h3') end |
#h3s_for(identifier) ⇒ Object
platform method to retrieve an array of h3s
766 767 768 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 766 def h3s_for(identifier) find_watir_elements("h3s(identifier)", Elements::Heading, identifier, 'h3') end |
#h4_for(identifier) ⇒ Object
platform method to retrieve the h4 element See PageObject::Accessors#h4
782 783 784 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 782 def h4_for(identifier) find_watir_element("h4(identifier)", Elements::Heading, identifier, 'h4') end |
#h4_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h4 See PageObject::Accessors#h4
774 775 776 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 774 def h4_text_for(identifier) process_watir_call("h4(identifier).text", Elements::Heading, identifier, nil, 'h4') end |
#h4s_for(identifier) ⇒ Object
platform method to retrieve an array of h4s
789 790 791 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 789 def h4s_for(identifier) find_watir_elements("h4s(identifier)", Elements::Heading, identifier, 'h4') end |
#h5_for(identifier) ⇒ Object
platform method to retrieve the h5 element See PageObject::Accessors#h5
805 806 807 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 805 def h5_for(identifier) find_watir_element("h5(identifier)", Elements::Heading, identifier, 'h5') end |
#h5_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h5 See PageObject::Accessors#h5
797 798 799 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 797 def h5_text_for(identifier) process_watir_call("h5(identifier).text", Elements::Heading, identifier, nil, 'h5') end |
#h5s_for(identifier) ⇒ Object
platform method to retrieve an array of h5s
812 813 814 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 812 def h5s_for(identifier) find_watir_elements("h5s(identifier)", Elements::Heading, identifier, 'h5') end |
#h6_for(identifier) ⇒ Object
platform method to retrieve the h6 element See PageObject::Accessors#h6
828 829 830 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 828 def h6_for(identifier) find_watir_element("h6(identifier)", Elements::Heading, identifier, 'h6') end |
#h6_text_for(identifier) ⇒ Object
platform method to retrieve the text for a h6 See PageObject::Accessors#h6
820 821 822 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 820 def h6_text_for(identifier) process_watir_call("h6(identifier).text", Elements::Heading, identifier, nil, 'h6') end |
#h6s_for(identifier) ⇒ Object
platform method to retrieve an array of h6s
835 836 837 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 835 def h6s_for(identifier) find_watir_elements("h6s(identifier)", Elements::Heading, identifier, 'h6') end |
#hidden_field_for(identifier) ⇒ Object
platform method to retrieve a hidden field element See PageObject::Accessors#hidden_field
277 278 279 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 277 def hidden_field_for(identifier) find_watir_element("hidden(identifier)", Elements::HiddenField, identifier) end |
#hidden_field_value_for(identifier) ⇒ Object
platform method to get the value stored in a hidden field See PageObject::Accessors#hidden_field
269 270 271 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 269 def hidden_field_value_for(identifier) process_watir_call("hidden(identifier).value", Elements::HiddenField, identifier) end |
#hidden_fields_for(identifier) ⇒ Object
platform method to retrieve an array of hidden field elements
284 285 286 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 284 def hidden_fields_for(identifier) find_watir_elements("hiddens(identifier)", Elements::HiddenField, identifier) end |
#html ⇒ Object
platform method to retrieve the html for the current page See PageObject#html
53 54 55 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 53 def html @browser.html end |
#i_for(identifier) ⇒ Object
platform method to retrieve the i element See PageObject::Accessors#i
1054 1055 1056 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1054 def i_for(identifier) find_watir_element("i(identifier)", Elements::Italic, identifier, 'i') end |
#i_text_for(identifier) ⇒ Object
platform method to retrieve the text for a i See PageObject::Accessors#i
1046 1047 1048 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1046 def i_text_for(identifier) process_watir_call("i(identifier).text", Elements::Italic, identifier, nil, 'i') end |
#image_for(identifier) ⇒ Object
platform method to retrieve an image element See PageObject::Accessors#image
606 607 608 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 606 def image_for(identifier) find_watir_element("image(identifier)", Elements::Image, identifier) end |
#image_loaded_for(identifier) ⇒ Object
platform method to retrieve load status of an image element See PageObject::Accessors#image
598 599 600 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 598 def image_loaded_for(identifier) process_watir_call("image(identifier).loaded?", Elements::Image, identifier) end |
#images_for(identifier) ⇒ Object
platform method to retrieve an array of image elements
613 614 615 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 613 def images_for(identifier) find_watir_elements("images(identifier)", Elements::Image, identifier) end |
#in_frame(identifier, frame = nil, &block) ⇒ Object
platform method to switch to a frame and execute a block See PageObject#in_frame
146 147 148 149 150 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 146 def in_frame(identifier, frame=nil, &block) frame = [] if frame.nil? frame << {frame: identifier} block.call(frame) end |
#in_iframe(identifier, frame = nil, &block) ⇒ Object
platform method to switch to an iframe and execute a block See PageObject#in_frame
156 157 158 159 160 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 156 def in_iframe(identifier, frame=nil, &block) frame = [] if frame.nil? frame << {iframe: identifier} block.call(frame) end |
#is_for(identifier) ⇒ Object
platform method to retrieve an array of is
1061 1062 1063 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1061 def is_for(identifier) find_watir_elements("is(identifier)", Elements::Italic, identifier, 'i') end |
#label_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Label element See PageObject::Accessors#label
874 875 876 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 874 def label_for(identifier) find_watir_element("label(identifier)", Elements::Label, identifier, 'label') end |
#label_text_for(identifier) ⇒ Object
platform method to return the text for a label See PageObject::Accessors#label
866 867 868 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 866 def label_text_for(identifier) process_watir_call("label(identifier).text", Elements::Label, identifier, nil, 'label') end |
#labels_for(identifier) ⇒ Object
platform method to retrieve an array of label elements
882 883 884 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 882 def labels_for(identifier) find_watir_elements("labels(identifier)", Elements::Label, identifier, 'label') end |
#link_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Link object see PageObject::Accessors#link
368 369 370 371 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 368 def link_for(identifier) call = "link(identifier)" find_watir_element(call, Elements::Link, identifier) end |
#links_for(identifier) ⇒ Object
platform method to retrieve an array of link elements
376 377 378 379 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 376 def links_for(identifier) call = "links(identifier)" find_watir_elements(call, Elements::Link, identifier) end |
#list_item_for(identifier) ⇒ Object
platform method to retrieve a list item element See PageObject::Accessors#list_item
644 645 646 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 644 def list_item_for(identifier) find_watir_element("li(identifier)", Elements::ListItem, identifier, 'li') end |
#list_item_text_for(identifier) ⇒ Object
platform method to retrieve the text from a list item See PageObject::Accessors#list_item
636 637 638 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 636 def list_item_text_for(identifier) process_watir_call("li(identifier).text", Elements::ListItem, identifier, nil, 'li') end |
#list_items_for(identifier) ⇒ Object
platform method to retrieve an array of list items
651 652 653 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 651 def list_items_for(identifier) find_watir_elements("lis(identifier)", Elements::ListItem, identifier, 'li') end |
#navigate_to(url) ⇒ Object
platform method to navigate to a provided url See PageObject#navigate_to
29 30 31 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 29 def navigate_to(url) @browser.goto url end |
#ordered_list_for(identifier) ⇒ Object
platform method to retrieve an ordered list element See PageObject::Accessors#ordered_list
690 691 692 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 690 def ordered_list_for(identifier) find_watir_element("ol(identifier)", Elements::OrderedList, identifier, 'ol') end |
#ordered_list_text_for(identifier) ⇒ Object
platform method to retrieve the text from an ordered list See PageObject::Accessors#ordered_list
682 683 684 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 682 def ordered_list_text_for(identifier) process_watir_call("ol(identifier).text", Elements::OrderedList, identifier, nil, 'ol') end |
#ordered_lists_for(identifier) ⇒ Object
platform method to retrieve an array of ordered lists
697 698 699 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 697 def ordered_lists_for(identifier) find_watir_elements("ols(identifier)", Elements::OrderedList, identifier, 'ol') end |
#page_for(identifier, page_class) ⇒ Object
platform method to return a PageObject rooted at an element See PageObject::Accessors#page_section
993 994 995 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 993 def page_for(identifier, page_class) find_watir_page(identifier, page_class) end |
#pages_for(identifier, page_class) ⇒ Object
platform method to return a collection of PageObjects rooted at elements See PageObject::Accessors#page_sections
1001 1002 1003 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1001 def pages_for(identifier, page_class) SectionCollection[*find_watir_pages(identifier, page_class)] end |
#paragraph_for(identifier) ⇒ Object
platform method to retrieve the paragraph element See PageObject::Accessors#paragraph
851 852 853 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 851 def paragraph_for(identifier) find_watir_element("p(identifier)", Elements::Paragraph, identifier, 'p') end |
#paragraph_text_for(identifier) ⇒ Object
platform method to retrieve the text for a paragraph See PageObject::Accessors#paragraph
843 844 845 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 843 def paragraph_text_for(identifier) process_watir_call("p(identifier).text", Elements::Paragraph, identifier, nil, 'p') end |
#paragraphs_for(identifier) ⇒ Object
platform method to retrieve an array of paragraph elements
858 859 860 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 858 def paragraphs_for(identifier) find_watir_elements("ps(identifier)", Elements::Paragraph, identifier, 'p') end |
#prompt(answer, frame = nil, &block) ⇒ Object
platform method to handle a prompt popup See PageObject#prompt
108 109 110 111 112 113 114 115 116 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 108 def prompt(answer, frame=nil, &block) switch_to_frame(frame) @browser.wd.execute_script "window.prompt = function(text, value) { window.__lastWatirPrompt = { message: text, default_value: value }; return #{answer}; }" yield result = @browser.wd.execute_script "return window.__lastWatirPrompt" switch_to_default_content(frame) result && result.dup.each_key { |k| result[k.to_sym] = result.delete(k) } result end |
#radio_button_for(identifier) ⇒ Object
platform method to return a PageObject::Eements::RadioButton element See PageObject::Accessors#radio_button
440 441 442 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 440 def (identifier) find_watir_element("radio(identifier)", Elements::RadioButton, identifier) end |
#radio_buttons_for(identifier) ⇒ Object
platform method to retrieve an array of radio button elements
447 448 449 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 447 def (identifier) find_watir_elements("radios(identifier)", Elements::RadioButton, identifier) end |
#radio_selected?(identifier) ⇒ Boolean
platform method to determine if a radio button is selected See PageObject::Accessors#radio_button
432 433 434 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 432 def radio_selected?(identifier) process_watir_call("radio(identifier).set?", Elements::RadioButton, identifier) end |
#refresh ⇒ Object
platform method to refresh the page See PageObject#refresh
166 167 168 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 166 def refresh @browser.refresh end |
#row_for(identifier) ⇒ Object
platform method to retrieve a table row element See PageObject::Accessors#row
583 584 585 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 583 def row_for(identifier) find_watir_element("tr(identifier)", Elements::TableRow, identifier, 'tr') end |
#row_text_for(identifier) ⇒ Object
platform method to retrieve the text from a table row See PageObject::Accessors#row
574 575 576 577 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 574 def row_text_for(identifier) process_watir_call("tr(identifier).text", Elements::TableRow, identifier, nil, 'tr') end |
#rows_for(identifier) ⇒ Object
platform method to retrieve an array of table row elements
590 591 592 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 590 def rows_for(identifier) find_watir_elements("trs(identifier)", Elements::TableRow, identifier, 'tr') end |
#save_screenshot(file_name) ⇒ Object
platform method to save the current screenshot to a file See PageObject#save_screenshot
198 199 200 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 198 def save_screenshot(file_name) @browser.wd.save_screenshot(file_name) end |
#select_list_for(identifier) ⇒ Object
platform method to return the select list element See PageObject::Accessors#select_list
344 345 346 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 344 def select_list_for(identifier) find_watir_element("select_list(identifier)", Elements::SelectList, identifier) end |
#select_list_value_for(identifier) ⇒ Object
platform method to get the currently selected value from a select list See PageObject::Accessors#select_list
324 325 326 327 328 329 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 324 def select_list_value_for(identifier) = find_watir_elements("select_list(identifier).selected_options", Elements::SelectList, identifier) return nil if .empty? .first.text end |
#select_list_value_set(identifier, value) ⇒ Object
platform method to select a value from a select list See PageObject::Accessors#select_list
335 336 337 338 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 335 def select_list_value_set(identifier, value) process_watir_call("select_list(identifier).select(value)", Elements::SelectList, identifier, value) end |
#select_lists_for(identifier) ⇒ Object
platform method to retrieve an array of select_list elements
351 352 353 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 351 def select_lists_for(identifier) find_watir_elements("select_lists(identifier)", Elements::SelectList, identifier) end |
#select_radio(identifier) ⇒ Object
platform method to select a radio button See PageObject::Accessors#radio_button
424 425 426 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 424 def select_radio(identifier) process_watir_call("radio(identifier).set", Elements::RadioButton, identifier) end |
#span_for(identifier) ⇒ Object
platform method to return a PageObject::Elements::Span element See PageObject::Accessors#span
486 487 488 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 486 def span_for(identifier) find_watir_element("span(identifier)", Elements::Span, identifier, 'span') end |
#span_text_for(identifier) ⇒ Object
platform method to return the text for a span See PageObject::Accessors#span
478 479 480 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 478 def span_text_for(identifier) process_watir_call("span(identifier).text", Elements::Span, identifier, nil, 'span') end |
#spans_for(identifier) ⇒ Object
platform method to retrieve an array of span elements
493 494 495 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 493 def spans_for(identifier) find_watir_elements("spans(identifier)", Elements::Span, identifier, 'span') end |
#svg_for(identifier) ⇒ Object
platform method to return a svg element
1008 1009 1010 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1008 def svg_for(identifier) find_watir_element("element(identifier)", Elements::Element, identifier) end |
#svgs_for(identifier) ⇒ Object
platform method to return an array of svg elements
1015 1016 1017 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 1015 def svgs_for(identifier) find_watir_elements("element(identifier)", Elements::Element, identifier) end |
#table_for(identifier) ⇒ Object
platform method to retrieve a table element See PageObject::Accessors#table
535 536 537 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 535 def table_for(identifier) find_watir_element("table(identifier)", Elements::Table, identifier, 'table') end |
#table_text_for(identifier) ⇒ Object
platform method to return the text for a table See PageObject::Accessors#table
527 528 529 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 527 def table_text_for(identifier) process_watir_call("table(identifier).text", Elements::Table, identifier, nil, 'table') end |
#tables_for(identifier) ⇒ Object
platform method to retrieve an array of table elements
542 543 544 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 542 def tables_for(identifier) find_watir_elements("tables(identifier)", Elements::Table, identifier, 'table') end |
#text ⇒ Object
platform method to retrieve the text from the current page See PageObject#text
45 46 47 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 45 def text @browser.text end |
#text_area_for(identifier) ⇒ Object
platform method to get the text area element See PageObject::Accessors#text_area
309 310 311 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 309 def text_area_for(identifier) find_watir_element("textarea(identifier)", Elements::TextArea, identifier) end |
#text_area_value_for(identifier) ⇒ Object
platform method to get the text from a textarea See PageObject::Accessors#text_area
301 302 303 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 301 def text_area_value_for(identifier) process_watir_call("textarea(identifier).value", Elements::TextArea, identifier) end |
#text_area_value_set(identifier, value) ⇒ Object
platform method to set text in a textarea See PageObject::Accessors#text_area
292 293 294 295 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 292 def text_area_value_set(identifier, value) process_watir_call("textarea(identifier).set(value)", Elements::TextArea, identifier, value) end |
#text_areas_for(identifier) ⇒ Object
platform method to retrieve an array of textarea elements
316 317 318 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 316 def text_areas_for(identifier) find_watir_elements("textareas(identifier)", Elements::TextArea, identifier) end |
#text_field_for(identifier) ⇒ Object
platform method to retrieve a text field element See PageObject::Accessors#text_field
222 223 224 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 222 def text_field_for(identifier) find_watir_element("text_field(identifier)", Elements::TextField, identifier) end |
#text_field_value_for(identifier) ⇒ Object
platform method to get the value stored in a text field See PageObject::Accessors#text_field
206 207 208 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 206 def text_field_value_for(identifier) process_watir_call("text_field(identifier).value", Elements::TextField, identifier) end |
#text_field_value_set(identifier, value) ⇒ Object
platform method to set the value for a text field See PageObject::Accessors#text_field
214 215 216 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 214 def text_field_value_set(identifier, value) process_watir_call("text_field(identifier).set(value)", Elements::TextField, identifier, value) end |
#text_fields_for(identifier) ⇒ Object
platform method to retrieve an array of text field elements
229 230 231 232 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 229 def text_fields_for(identifier) elements = find_watir_elements("text_fields(identifier)", Elements::TextField, identifier) elements.select { |e| e.element.tag_name == 'input' } end |
#title ⇒ Object
platform method to retrieve the title for the current page See PageObject#title
61 62 63 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 61 def title @browser.title end |
#uncheck_checkbox(identifier) ⇒ Object
platform method to uncheck a checkbox See PageObject::Accessors#checkbox
393 394 395 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 393 def uncheck_checkbox(identifier) process_watir_call("checkbox(identifier).clear", Elements::CheckBox, identifier) end |
#unordered_list_for(identifier) ⇒ Object
platform method to retrieve an unordered list element See PageObject::Accessors#unordered_list
667 668 669 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 667 def unordered_list_for(identifier) find_watir_element("ul(identifier)", Elements::UnorderedList, identifier, 'ul') end |
#unordered_list_text_for(identifier) ⇒ Object
platform method to retrieve the text from an unordered list See PageObject::Accessors#unordered_list
659 660 661 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 659 def unordered_list_text_for(identifier) process_watir_call("ul(identifier).text", Elements::UnorderedList, identifier, nil, 'ul') end |
#unordered_lists_for(identifier) ⇒ Object
platform method to retrieve an array of unordered lists
674 675 676 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 674 def unordered_lists_for(identifier) find_watir_elements("uls(identifier)", Elements::UnorderedList, identifier, 'ul') end |
#video_for(identifier) ⇒ Object
platform method to retrieve a video element
962 963 964 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 962 def video_for(identifier) find_watir_element("video(identifier)", Elements::Video, identifier, 'video') end |
#videos_for(identifier) ⇒ Object
platform method to retrieve an array of video elements
969 970 971 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 969 def videos_for(identifier) find_watir_elements("videos(identifier)", Elements::Video, identifier, 'video') end |
#wait_until(timeout, message = nil, &block) ⇒ Object
platform method to wait for a block to return true See PageObject#wait_until
68 69 70 |
# File 'lib/page-object/platforms/watir/page_object.rb', line 68 def wait_until(timeout, = nil, &block) @browser.wait_until(timeout: timeout, message: , &block) end |