Class: Ext::EditorGrid
- Defined in:
- lib/selenium-extjs/component/Grid.rb
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
- #click_at_cell(x, y) ⇒ Object
- #edit_row(row, data) ⇒ Object
- #get_row(row) ⇒ Object
-
#num_rows ⇒ Object
number of lines of Grid (store!).
Methods inherited from Component
#getId, #highlight, #init_component, #initialize, #method_missing, #node, #selector, #wait_for_ajax
Constructor Details
This class inherits a constructor from Ext::Component
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ext::Component
Instance Method Details
#click_at_cell(x, y) ⇒ Object
9 10 11 |
# File 'lib/selenium-extjs/component/Grid.rb', line 9 def click_at_cell(x,y) @selenium.click_at(node() + "//div[contains(@class,'x-grid3-body')]//div[#{x}]//table//td[#{y}]", "0,0") end |
#edit_row(row, data) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/selenium-extjs/component/Grid.rb', line 33 def edit_row(row, data) len = @selenium.get_eval("window.Ext.getCmp('#{@id}').colModel.columns.length").to_i len.times().each do |idx| print "window.Ext.getCmp('#{@id}').colModel.columns[#{idx}].getEditor().getId()" begin editable = @selenium.get_eval("window.Ext.getCmp('#{@id}').colModel.columns[#{idx}].getEditor().getId()"); click_at_cell(row, idx + 1) # @selenium.highlight(node() + "//div[contains(@class,'x-grid3-body')]//div[#{row}]//table//td[#{idx+1}]") @selenium.wait_for_component_visible(editable) @selenium.type(node() + "//*[@id='#{editable}']", data[idx]) @selenium.fire_event(node() + "//*[@id='#{editable}']", "blur") sleep 1 rescue RuntimeError => ex p ex end end end |
#get_row(row) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/selenium-extjs/component/Grid.rb', line 18 def get_row(row) len = @selenium.get_eval("window.Ext.getCmp('#{@id}').colModel.columns.length").to_i ret = {} len.times().each do |idx| begin data_index = @selenium.get_eval("window.Ext.getCmp('#{@id}').colModel.columns[#{idx}].dataIndex"); text = @selenium.get_text(node() + "//div[contains(@class,'x-grid3-body')]//div[#{row}]//table//td[#{idx+1}]") ret[data_index.to_sym] = text rescue Selenium::CommandError => ex p ex end end ret end |
#num_rows ⇒ Object
number of lines of Grid (store!)
14 15 16 |
# File 'lib/selenium-extjs/component/Grid.rb', line 14 def num_rows() @selenium.get_eval("window.Ext.getCmp('#{@id}').getStore().getCount()").to_i end |