class PageObject::Elements::TextField

Public Class Methods

new(element, platform) click to toggle source
# File lib/page-object/elements/text_field.rb, line 6
def initialize(element, platform)
  @element = element
  include_platform_for platform
end

Protected Class Methods

selenium_finders() click to toggle source
# File lib/page-object/elements/text_field.rb, line 21
def self.selenium_finders
  super + [:title, :value, :text, :label]
end
watir_finders() click to toggle source
# File lib/page-object/elements/text_field.rb, line 17
def self.watir_finders
  super + [:title, :value, :text, :label]
end

Public Instance Methods

append(text) click to toggle source
# File lib/page-object/elements/text_field.rb, line 11
def append(text)
  element.send_keys text
end

Protected Instance Methods

include_platform_for(platform) click to toggle source
# File lib/page-object/elements/text_field.rb, line 25
def include_platform_for platform
  super
  if platform[:platform] == :watir_webdriver
    require 'page-object/platforms/watir_webdriver/text_field'
    self.class.send :include, PageObject::Platforms::WatirWebDriver::TextField
  elsif platform[:platform] == :selenium_webdriver
    require 'page-object/platforms/selenium_webdriver/text_field'
    self.class.send :include, PageObject::Platforms::SeleniumWebDriver::TextField
  else
    raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
  end
end