module Kameleon::DSL::Context::SpecialSelectors
! extending selectors in capybara way github.com/jnicklas/capybara/blob/master/lib/capybara.rb#L76
Public Class Methods
cell(param)
click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 77 def self.cell(param) value_in_row, value_in_column = *param if value_in_row.is_a?(Fixnum) and value_in_column.is_a?(Fixnum) [:xpath, "//tbody/tr[#{value_in_row}]/td[#{value_in_column}]"] else #! on page there might be more then one table result = Capybara.current_session.all(:xpath, "//table//th") elements = result.each.to_a position = elements.index { |n| n.text =~ /#{value_in_column}/ } [:xpath, "//tr[*='#{value_in_row}'][1]/td[#{position+1}]"] end end
column(param)
click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 90 def self.column(param) raise "not implemented" # position = session.all(:xpath, "//table//th").index { |n| n.text =~ /#{value}/ } # return [:xpath, ".//table//th[#{position + 1}] | .//table//td[#{position + 1}]", :select_multiple] end
row(param)
click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 66 def self.row(param) case param when String [:xpath, "//tr[*='#{param}'][1]"] when Fixnum [:xpath, "//tbody/tr[#{param}]"] else raise "not implemented" end end