Class: SK::KFilter
- Inherits:
-
Object
- Object
- SK::KFilter
- Defined in:
- lib/kendo.rb
Instance Method Summary collapse
-
#clear ⇒ Object
pause 1.
-
#click ⇒ Object
puts “find filter = #@filter”.
-
#initialize(n) ⇒ KFilter
constructor
A new instance of KFilter.
- #select(value) ⇒ Object
Constructor Details
#initialize(n) ⇒ KFilter
Returns a new instance of KFilter.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/kendo.rb', line 90 def initialize(n) @filter = nil # in case of error # first check that the current page has a kendo grid grid = SK::KGrid.new() return if ! grid # then work our way throught the page/grid... # list of all the column headers; this is a little # fragile if the page has other tables before the grid th_list = SK::Browser.all({tag_name: 'th'}) return if !th_list return if th_list.length < n header = th_list[n] # the nth header for the column # puts "attribute = #{header.attribute('data-field')}" @filter = header.find_element({class: 'k-grid-filter'}) # puts "find filter = #{@filter}" end |
Instance Method Details
#clear ⇒ Object
pause 1
111 112 113 114 115 116 |
# File 'lib/kendo.rb', line 111 def clear = SK::Browser.all({tag_name: 'button'}) = .find { |el| el.text == 'Clear' } .click if sleep 1 end |
#click ⇒ Object
puts “find filter = #@filter”
106 107 108 109 110 |
# File 'lib/kendo.rb', line 106 def click # puts "click filter = #{@filter}" @filter.click() # makes AC it visible # pause 1 end |
#select(value) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/kendo.rb', line 117 def select(value) containers = SK::Browser.all({class: 'k-animation-container'}) container = containers.find { |c| c.displayed? } sleep 1 # to find the textbox??? textbox = container.find_element({class: 'k-textbox'}) trace "filter's textbox is not visisble" unless textbox.displayed? textbox.send_keys(value) = container.find_element({class: 'k-primary'}) .click() sleep 1 end |