Class: Sapphire::Plugins::PassedControlHighlighter
- Defined in:
- lib/sapphire/Plugins/Highlighters/PassedControlHighlighter.rb
Instance Attribute Summary
Attributes inherited from Plugin
Class Method Summary collapse
Instance Method Summary collapse
- #Before(instance, method, args) ⇒ Object
-
#initialize ⇒ PassedControlHighlighter
constructor
A new instance of PassedControlHighlighter.
Methods inherited from Plugin
Constructor Details
#initialize ⇒ PassedControlHighlighter
Returns a new instance of PassedControlHighlighter.
6 7 8 9 10 11 |
# File 'lib/sapphire/Plugins/Highlighters/PassedControlHighlighter.rb', line 6 def initialize observes :class => DSL::ControlEvaluation, :method => :Passed end |
Class Method Details
.IsObserver ⇒ Object
35 36 37 |
# File 'lib/sapphire/Plugins/Highlighters/PassedControlHighlighter.rb', line 35 def self.IsObserver() true end |
Instance Method Details
#Before(instance, method, args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sapphire/Plugins/Highlighters/PassedControlHighlighter.rb', line 13 def Before(instance, method, args) return if ENV["highlighter"] != "true" control = args[0] discriminator = control.found_by_type selector = control.found_by_value begin if(discriminator == :id) $driver.ExecuteScript("document.getElementById('#{selector}').style.backgroundColor = '#00FF00'; ") elsif (discriminator == :name ) $driver.ExecuteScript("document.getElementByName('#{selector}').style.backgroundColor = '#00FF00'; ") elsif (discriminator == :xpath) $driver.ExecuteScript("document.evaluate( '#{selector}', document, null, XPathResult.ANY_TYPE, null ).iterateNext().style.backgroundColor = '#00FF00'; ") end rescue end end |