Created
March 5, 2012 23:38
-
-
Save timlinquist/1982097 to your computer and use it in GitHub Desktop.
Custom listener for the selenium webdriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Used in the common/driver.rb of selenium-webdriver | |
L45 def for(browser, opts = {}) | |
..... | |
class SeleniumListener | |
attr_reader :file | |
def initialize | |
@file = File.new('output.log', 'w+') | |
end | |
[:get, :goForward, :goBack, :clickElement, :clearElement, :navigate_to, :find, :click, :change_value_of, | |
:sendKeysToElement, :execute_script, :find_element_by, :find_elements_by, :executeScript, :quit, :close].each do |method| | |
define_method("before_#{method}") do |*args| | |
file.puts "\n\nAbout to call #{method}: #{args}\n\n" | |
end | |
define_method("after_#{method}") do |*args| | |
file.puts "\n\nCompleted call of #{method}\n\n" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment