Class: Flunky::Drivers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/flunky/drivers/base.rb

Overview

The backend contract. A driver is the only place that knows how to talk to a real browser, so swapping backends (Ferrum, a remote CDP service, a stub in tests) means implementing this interface and nothing else.

Every interactive method takes a ref: the integer the snapshot stamped on an element as a data-ai-ref attribute. Turning that ref back into a live node is the driver’s job.

Direct Known Subclasses

FerrumDriver

Instance Method Summary collapse

Instance Method Details

#click(_ref) ⇒ Object



46
47
48
# File 'lib/flunky/drivers/base.rb', line 46

def click(_ref)
  not_supported(:click)
end

#current_urlObject



25
26
27
# File 'lib/flunky/drivers/base.rb', line 25

def current_url
  not_supported(:current_url)
end

#evaluate(_js) ⇒ Object

Run JS in the page and return its value.



38
39
40
# File 'lib/flunky/drivers/base.rb', line 38

def evaluate(_js)
  not_supported(:evaluate)
end

#go_to(_url) ⇒ Object



21
22
23
# File 'lib/flunky/drivers/base.rb', line 21

def go_to(_url)
  not_supported(:go_to)
end

#htmlObject



33
34
35
# File 'lib/flunky/drivers/base.rb', line 33

def html
  not_supported(:html)
end

#press_key(_key) ⇒ Object



58
59
60
# File 'lib/flunky/drivers/base.rb', line 58

def press_key(_key)
  not_supported(:press_key)
end

#quitObject



17
18
19
# File 'lib/flunky/drivers/base.rb', line 17

def quit
  not_supported(:quit)
end

#screenshot_base64Object



42
43
44
# File 'lib/flunky/drivers/base.rb', line 42

def screenshot_base64
  not_supported(:screenshot_base64)
end

#scroll_by(_dx, _dy) ⇒ Object



62
63
64
# File 'lib/flunky/drivers/base.rb', line 62

def scroll_by(_dx, _dy)
  not_supported(:scroll_by)
end

#select_option(_ref, _value) ⇒ Object



54
55
56
# File 'lib/flunky/drivers/base.rb', line 54

def select_option(_ref, _value)
  not_supported(:select_option)
end

#startObject



13
14
15
# File 'lib/flunky/drivers/base.rb', line 13

def start
  not_supported(:start)
end

#titleObject



29
30
31
# File 'lib/flunky/drivers/base.rb', line 29

def title
  not_supported(:title)
end

#type_text(_ref, _text, clear: false) ⇒ Object



50
51
52
# File 'lib/flunky/drivers/base.rb', line 50

def type_text(_ref, _text, clear: false)
  not_supported(:type_text)
end