Class: EasyAutomation::Page

Inherits:
Selenium::WebPage
  • Object
show all
Defined in:
lib/easy_automation/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser, path) ⇒ Page

Default constructor



13
14
15
16
17
# File 'lib/easy_automation/page.rb', line 13

def initialize(browser, path)
  @elements = LoadData.load_xpath_elements(self.class.to_s, path)
  super(browser, @elements.title)
  @browser = browser
end

Instance Attribute Details

#elementsObject (readonly)

Returns all elements for current page



61
62
63
# File 'lib/easy_automation/page.rb', line 61

def elements
  @elements
end

Instance Method Details

#go_backObject

it goes back one place in history



45
46
47
48
# File 'lib/easy_automation/page.rb', line 45

def go_back
  browser.browser.go_back()
  self.wait_page_load
end

#htmlObject

Gets body text



24
25
26
# File 'lib/easy_automation/page.rb', line 24

def html
  browser.html()
end

#refreshObject

Refresh current page and waits to be loaded



53
54
55
56
# File 'lib/easy_automation/page.rb', line 53

def refresh
  browser.browser.refresh
  self.wait_page_load
end

#titleObject

Returns page title



31
32
33
# File 'lib/easy_automation/page.rb', line 31

def title
  browser.title
end

#wait_page_loadObject

Waits for page to load



38
39
40
# File 'lib/easy_automation/page.rb', line 38

def wait_page_load
  browser.wait_for_load
end