Class: Cello::PageObjects::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/cello/pageobjects/browser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser) ⇒ Browser

Returns a new instance of Browser.



10
11
12
# File 'lib/cello/pageobjects/browser.rb', line 10

def initialize browser
  @browser = Watir::Browser.new browser
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments) ⇒ Object



42
43
44
# File 'lib/cello/pageobjects/browser.rb', line 42

def method_missing method_name, *arguments
  @context.send method_name, *arguments
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



8
9
10
# File 'lib/cello/pageobjects/browser.rb', line 8

def browser
  @browser
end

#context(page) ⇒ Object

Returns the value of attribute context.



7
8
9
# File 'lib/cello/pageobjects/browser.rb', line 7

def context
  @context
end

Instance Method Details

#closeObject



26
27
28
# File 'lib/cello/pageobjects/browser.rb', line 26

def close
  @browser.close
end

#get_screenshotObject



30
31
32
# File 'lib/cello/pageobjects/browser.rb', line 30

def get_screenshot
  @browser.driver.save_screenshot 'screenshot.png'
end

#response_timeObject



38
39
40
# File 'lib/cello/pageobjects/browser.rb', line 38

def response_time
  #pending
end

#search(text) ⇒ Object



22
23
24
# File 'lib/cello/pageobjects/browser.rb', line 22

def search text 
 @browser.text.include? text 
end

#titleObject



34
35
36
# File 'lib/cello/pageobjects/browser.rb', line 34

def title
  @browser.title
end

#visitObject



14
15
16
# File 'lib/cello/pageobjects/browser.rb', line 14

def visit
  @context.visit
end