Class: Browserctl::Driver::FerrumPageDriver

Inherits:
Object
  • Object
show all
Includes:
PageDriver
Defined in:
lib/browserctl/driver/ferrum_page_driver.rb

Overview

The only PageDriver implementation v0.15 ships. Wraps a Ferrum page (or CDPPage delegator over one) and forwards each interface method to the underlying Ferrum API. Intentionally dumb — no caching, no policy, no logging. Anything beyond plain forwarding belongs in the handler or in a dedicated wrapper, not here.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ FerrumPageDriver

Returns a new instance of FerrumPageDriver.



20
21
22
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 20

def initialize(page)
  @raw_page = page
end

Instance Attribute Details

#raw_pageObject (readonly)

Returns the underlying Ferrum/CDP page. Exposed for callers that still bridge through Ferrum-typed APIs (currently only the CDP driver’s ‘devtools_info`). New handler code must not use this.

Returns:

  • (Object)

    the underlying Ferrum/CDP page. Exposed for callers that still bridge through Ferrum-typed APIs (currently only the CDP driver’s ‘devtools_info`). New handler code must not use this.



18
19
20
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 18

def raw_page
  @raw_page
end

Instance Method Details

#activateObject



30
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 30

def activate = @raw_page.activate

#at_css(selector) ⇒ Object



28
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 28

def at_css(selector) = @raw_page.at_css(selector)

#bodyObject



26
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 26

def body = @raw_page.body

#closeObject



31
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 31

def close = @raw_page.close

#cookies_allObject



37
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 37

def cookies_all = @raw_page.cookies.all

#cookies_clearObject



39
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 39

def cookies_clear = @raw_page.cookies.clear

#cookies_setObject



38
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 38

def cookies_set(**) = @raw_page.cookies.set(**)

#current_urlObject



25
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 25

def current_url = @raw_page.current_url

#evaluate(expression) ⇒ Object



27
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 27

def evaluate(expression) = @raw_page.evaluate(expression)

#go_to(url) ⇒ Object



24
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 24

def go_to(url) = @raw_page.go_to(url)

#keyboard_down(key) ⇒ Object



34
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 34

def keyboard_down(key) = @raw_page.keyboard.down(key)

#keyboard_up(key) ⇒ Object



35
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 35

def keyboard_up(key) = @raw_page.keyboard.up(key)

#mouse_move(x:, y:) ⇒ Object

rubocop:disable Naming/MethodParameterName



36
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 36

def mouse_move(x:, y:) = @raw_page.mouse.move(x: x, y: y) # rubocop:disable Naming/MethodParameterName

#off(event, id) ⇒ Object



33
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 33

def off(event, id) = @raw_page.off(event, id)

#on(event) ⇒ Object



32
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 32

def on(event, &) = @raw_page.on(event, &)

#screenshot(path:, full: false) ⇒ Object



29
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 29

def screenshot(path:, full: false) = @raw_page.screenshot(path: path, full: full)

#target_idObject



40
# File 'lib/browserctl/driver/ferrum_page_driver.rb', line 40

def target_id = @raw_page.target_id