Class: SeleniumRecord::NavigationItem

Inherits:
Base
  • Object
show all
Defined in:
lib/selenium_record/navigation_item.rb

Overview

Base model to be extended by all Selenium page objects

Constant Summary

Constants included from Waits

Waits::DEFAULT_WAITING_TIME

Constants included from Core

Core::SUBCLASS_RESPONSABILITY

Instance Attribute Summary

Attributes inherited from Base

#browser, #object, #parent_el, #root_el

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#create_record, #create_record_for_action, #exist?, extract_klass, #initialize

Methods included from ComponentAutoload

component_loader, extract_group, extract_namespace, extract_options, included, #method_missing, #modal_for, #panel_for, #pill_for, #tab_for, #view_for

Methods included from Translations

#trans

Methods included from Theme

#dropdown_menu_xpath, #dropdown_xpath, #find_headline, #modal_header_xpath, #section_xpath, #select_option_xpath, #select_xpath

Methods included from Html

#tag_name, #to_html

Methods included from Axis

#after?, #before?, #following_sibling_elements, #ordered?, #preceding_sibling_elements

Methods included from Preconditions

#when_clickable, #when_hidden, #when_modal_present, #when_present

Methods included from Waits

included, #wait_displayed, #wait_fade_in, #wait_hidden, #wait_js_inactive, #wait_page_load

Methods included from Scopes

#scope

Methods included from ActionBuilder

#action_builder

Methods included from Actions

#accept_popup, #choose_menu, choose_option, #clear, #click, #click_on, #click_wait, #fill, #focus, #pop_last, #select_from_chosen, #submit, #textarea_content

Methods included from Lookup

included, #lookup, #lookup_sequence, #lookup_step

Methods included from Core

#find, #find!, #find_elements, #first_last, #load_dom, #load_dom!

Methods included from Configuration

#so_module

Constructor Details

This class inherits a constructor from SeleniumRecord::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SeleniumRecord::ComponentAutoload

Class Method Details

Class method to create the ‘before_navigate’ hook defining the title of the page

Parameters:

  • key (String)

    key to lookup text translation for menu title of the page



35
36
37
38
39
# File 'lib/selenium_record/navigation_item.rb', line 35

def self.navigate_to(key)
  define_method :before_navigate do
    @title = trans key
  end
end

Instance Method Details

#before_load_domObject



8
9
10
11
# File 'lib/selenium_record/navigation_item.rb', line 8

def before_load_dom
  before_navigate if respond_to? :before_navigate
  navigate unless current?
end


13
14
15
16
# File 'lib/selenium_record/navigation_item.rb', line 13

def click_link(*args)
  super
  self
end

#reloadObject



18
19
20
21
22
23
24
25
26
27
28
29
# 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