Class: Calliper::Page
- Inherits:
-
Object
show all
- Defined in:
- lib/calliper/page.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/calliper/page.rb', line 29
def method_missing(method_name, *args)
if driver.respond_to?(method_name)
driver.__send__(method_name, *args)
else
super
end
end
|
Instance Attribute Details
#base_url ⇒ Object
21
22
23
|
# File 'lib/calliper/page.rb', line 21
def base_url
@base_url ||= Config.base_url
end
|
Class Method Details
.get(*args) ⇒ Object
5
6
7
8
9
|
# File 'lib/calliper/page.rb', line 5
def self.get(*args)
page = new
page.get(*args)
page
end
|
Instance Method Details
#driver ⇒ Object
25
26
27
|
# File 'lib/calliper/page.rb', line 25
def driver
Calliper.driver
end
|
#get(path, options = {}) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/calliper/page.rb', line 11
def get(path, options = {})
url = path =~ %r(^http://) ? path : "#{base_url}#{path}"
driver.get(url)
if options[:sync].nil? || options[:sync]
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { driver.find_element(css: "[ng-app]") }
end
end
|