lib/element.rb in gridium-0.1.7 vs lib/element.rb in gridium-0.1.8
- old
+ new
@@ -1,7 +1,8 @@
require 'selenium-webdriver'
require 'oily_png'
+require 'spec_data'
class Element
attr_reader :name, :by, :locator
def initialize(name, by, locator)
@@ -31,11 +32,11 @@
end
@element
end
- def element= e
+ def element=(e)
@element = e
end
def displayed_element
found_element = nil
@@ -178,13 +179,13 @@
def text
element.text
end
- def text= text
+ def text=(text)
element.clear
- element.send_keys text
+ element.send_keys(text)
end
def value
element.attribute("value")
end
@@ -232,10 +233,10 @@
image = ChunkyPNG::Image.from_file(screenshot_path.to_s)
image1 = image.crop(location_x, location_y, element_width, element_height)
image2 = image1.to_image
element_screenshot_path = File.join($current_run_dir, "#{name}__#{timestamp}.png")
image2.save(element_screenshot_path)
- $screenshots_captured.push("#{name}__#{timestamp}.png")
+ SpecData.screenshots_captured.push("#{name}__#{timestamp}.png")
end
def method_missing(method_sym, *arguments, &block)
Log.debug("called #{method_sym} on element #{@locator} by #{@by_type}")
if @element.respond_to?(method_sym)
\ No newline at end of file