class LdsMenu

Public Class Methods

new(browser,menu_item_text) click to toggle source

constructor

# File lib/TNR360/components/lds_menu.rb, line 9
def initialize(browser,menu_item_text)
  @browser =browser
  @menu_item_text=menu_item_text
  @exists
end

Public Instance Methods

click() click to toggle source
# File lib/TNR360/components/lds_menu.rb, line 22
def click
  menu_path = @menu_item_text.split('/')
  raise "Provide at least one level of menu item" if (menu_path.length < 1)
  for i in 0..(menu_path.length-1)
    puts "Value of local variable is #{i}"
    case i
      when 0
        @browser.div.li(:id => menu_path[i]).when_present.click
        sleep($small_wait_time)
      when 1
        @browser.div.table(:id=> menu_path[i]).button.when_present.click
        sleep($small_wait_time)
      when i==menu_path.length-1
        @browser.a(:text=>menu_path[i]).when_present.click
        sleep($small_wait_time)
      else
        @browser.a(:text=>menu_path[i]).when_present.hover
        sleep($small_wait_time)
        if i==menu_path.length-1
          @browser.a(:text=>menu_path[i]).when_present.click
        end
    end
  end
end
to_s() click to toggle source

print object

# File lib/TNR360/components/lds_menu.rb, line 15
def to_s
  "\n***** Menu *****"+
      "\nMenu item text : "+ bool_no_null(@menu_item_text.to_s)+
      "\n**********"
end