Class: Akephalos::Page
- Inherits:
-
Object
- Object
- Akephalos::Page
- Defined in:
- lib/akephalos/page.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #current_url ⇒ Object
- #evaluate_script(script) ⇒ Object
- #execute_script(script) ⇒ Object
- #find(selector) ⇒ Object
-
#initialize(page) ⇒ Page
constructor
A new instance of Page.
- #modified_source ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(page) ⇒ Page
Returns a new instance of Page.
3 4 5 6 |
# File 'lib/akephalos/page.rb', line 3 def initialize(page) @nodes = [] @_page = page end |
Instance Method Details
#==(other) ⇒ Object
35 36 37 |
# File 'lib/akephalos/page.rb', line 35 def ==(other) @_page == other end |
#current_url ⇒ Object
22 23 24 |
# File 'lib/akephalos/page.rb', line 22 def current_url @_page.getWebResponse.getRequestSettings.getUrl.toString end |
#evaluate_script(script) ⇒ Object
31 32 33 |
# File 'lib/akephalos/page.rb', line 31 def evaluate_script(script) @_page.executeJavaScript(script).getJavaScriptResult end |
#execute_script(script) ⇒ Object
26 27 28 29 |
# File 'lib/akephalos/page.rb', line 26 def execute_script(script) @_page.executeJavaScript(script) nil end |
#find(selector) ⇒ Object
8 9 10 11 12 |
# File 'lib/akephalos/page.rb', line 8 def find(selector) nodes = @_page.getByXPath(selector).map { |node| Node.new(node) } @nodes << nodes nodes end |
#modified_source ⇒ Object
14 15 16 |
# File 'lib/akephalos/page.rb', line 14 def modified_source @_page.asXml end |
#source ⇒ Object
18 19 20 |
# File 'lib/akephalos/page.rb', line 18 def source @_page.getWebResponse.getContentAsString end |