module Symbiont module WebObjects class TextField < WebObject def initialize(web_object, platform) @web_object = web_object include_platform_specifics_for(platform) end def append(text) web_object.send_keys text end def self.usable_selectors_for_watir super + [:title, :value, :text, :label] end def self.usable_selectors_for_selenium super + [:title, :value, :text, :label] end def include_platform_specifics_for(platform) super if platform[:platform] == :watir_webdriver require 'symbiont/platform_watir/web_objects/text_field' self.class.send :include, Symbiont::Platforms::WatirWebDriver::TextField elsif platform[:platform] == :selenium_webdriver require 'symbiont/platform_selenium/web_objects/text_field' self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TextField else raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported." end end end # class: TextField ::Symbiont::WebObjects.class_for_type[:text] = ::Symbiont::WebObjects::TextField ::Symbiont::WebObjects.class_for_type[:password] = ::Symbiont::WebObjects::TextField end # module: WebObjects end # module: Symbiont