class SeleniumRecord::NavigationItem

Base model to be extended by all Selenium page objects

Public Class Methods

navigate_to(key) click to toggle source

Class method to create the ‘before_navigate’ hook defining the title of the page @param key [String] key to lookup text translation for menu title of

the page

Public Instance Methods

before_load_dom() click to toggle source
# File lib/selenium_record/navigation_item.rb, line 8
def before_load_dom
  before_navigate if respond_to? :before_navigate
  navigate unless current?
end
reload() click to toggle source
# File lib/selenium_record/navigation_item.rb, line 18
def reload
  find(link_active_locator).click
  wait_page_load
  self
rescue => error
  if error.is_a? Selenium::WebDriver::Error::StaleElementReferenceError
    load_dom
    retry
  else
    raise
  end
end

Private Instance Methods

current?() click to toggle source

@return [Boolean] Marks whether the current browser page matches the new

new instantiated page object
# File lib/selenium_record/navigation_item.rb, line 65
def current?
  browser.find_element(link_active_locator)
rescue Selenium::WebDriver::Error::NoSuchElementError
  false
end
navigate() click to toggle source

Checks whether the current page corresponds to the instance page and in case of mismatch clicks on the navigation menu for loading the instance page