Class: SK::KGrid
Instance Method Summary
collapse
Methods inherited from KElement
#el, #exists?, #html, #text
Constructor Details
#initialize(locator = {id: 'grid'}) ⇒ KGrid
Returns a new instance of KGrid.
42
43
44
|
# File 'lib/kendo.rb', line 42
def initialize(locator={id: 'grid'})
super(SK::Browser.find(locator))
end
|
Instance Method Details
#first_page_button ⇒ Object
65
66
67
|
# File 'lib/kendo.rb', line 65
def first_page_button
self.grid.find_element({class: 'k-pager-first'})
end
|
#grid ⇒ Object
45
46
47
|
# File 'lib/kendo.rb', line 45
def grid
el
end
|
#items_count ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/kendo.rb', line 52
def items_count()
return 0 unless self.grid
return 0 unless self.items_label
count = /(\d*) items/.match(self.items_label.text)[1].to_i
return count
end
|
#items_label ⇒ Object
48
49
50
51
|
# File 'lib/kendo.rb', line 48
def items_label()
return nil unless grid
self.grid.find_element({class: 'k-pager-info'})
end
|
#last_page_button ⇒ Object
62
63
64
|
# File 'lib/kendo.rb', line 62
def last_page_button
self.grid.find_element({class: 'k-pager-last'})
end
|
#next_page_button ⇒ Object
73
74
75
76
77
|
# File 'lib/kendo.rb', line 73
def next_page_button
span = self.grid.find_element({class: 'k-i-arrow-e'})
span.find_element({xpath: '..'})
end
|
#pages_count ⇒ Object
59
60
61
|
# File 'lib/kendo.rb', line 59
def pages_count
last_page_button.attribute('data-page').to_i
end
|
#prev_page_button ⇒ Object
68
69
70
71
72
|
# File 'lib/kendo.rb', line 68
def prev_page_button
span = self.grid.find_element({class: 'k-i-arrow-w'})
span.find_element({xpath: '..'})
end
|
#row(n) ⇒ Object
83
84
85
|
# File 'lib/kendo.rb', line 83
def row(n)
SK::KRow.new(self.rows[n])
end
|
#rows ⇒ Object
78
79
80
81
82
|
# File 'lib/kendo.rb', line 78
def rows
set = self.grid.find_elements({tag_name: 'tr'})
set
end
|