TextField, TextArea
# File lib/rwebspec-webdriver/element_locator.rb, line 74 def attribute_expression(selectors) selectors.map do |key, val| if val.kind_of?(Array) "(" + val.map { |v| equal_pair(key, v) }.join(" or ") + ")" else equal_pair(key, val) end end.join(" and ") end
# File lib/rwebspec-webdriver/element_locator.rb, line 10 def check_box_elements(how, what, opts = []) find_elements(:xpath, ".//input[#{attribute_expression :type => CHECK_BOX_TYPES}]") end
# File lib/rwebspec-webdriver/element_locator.rb, line 52 def equal_pair(key, value) # we assume :label means a corresponding label element, not the attribute if key == :label && should_use_label_element? "@id=//label[normalize-space()='#{value}']/@for" else "#{lhs_for(key)}='#{value}'" end end
# File lib/rwebspec-webdriver/element_locator.rb, line 34 def file_field_elements find_elements(:xpath, ".//input[#{attribute_expression :type => FILE_FIELD_TYPES}]") end
# File lib/rwebspec-webdriver/element_locator.rb, line 44 def find_by_tag(tag) find_elements(:tag_name, tag) end
# File lib/rwebspec-webdriver/element_locator.rb, line 61 def lhs_for(key) case key when :text, 'text' 'normalize-space()' when :href # TODO: change this behaviour? 'normalize-space(@href)' else "@#{key.to_s.gsub("_", "-")}" end end
# File lib/rwebspec-webdriver/element_locator.rb, line 15 def radio_elements(how, what, opts = []) find_elements(:xpath, ".//input[#{attribute_expression :type => RADIO_TYPES}]") end
# File lib/rwebspec-webdriver/element_locator.rb, line 19 def select_elements(how, what, opts = []) find_elements(:xpath, ".//input[#{attribute_expression :type => RADIO_TYPES}]") end
# File lib/rwebspec-webdriver/element_locator.rb, line 48 def should_use_label_element? @selector[:tag_name] != "option" rescue false end
# File lib/rwebspec-webdriver/element_locator.rb, line 29 def text_area_elements find_elements(:xpath, ".//textarea") end
# File lib/rwebspec-webdriver/element_locator.rb, line 25 def text_field_elements find_elements(:xpath, ".//input[#{attribute_expression :type => TEXT_FILED_TYPES}]") end