Class: Playwright::ChannelOwners::ElementHandle
- Inherits:
-
JSHandle
- Object
- PlaywrightApi
- JSHandle
- Playwright::ChannelOwners::ElementHandle
- Defined in:
- lib/playwright/channel_owners/element_handle.rb
Instance Method Summary collapse
- #click(button: nil, clickCount: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil) ⇒ Object
- #eval_on_selector(selector, pageFunction, arg: nil) ⇒ Object
- #eval_on_selector_all(selector, pageFunction, arg: nil) ⇒ Object
- #press(key, delay: nil, noWaitAfter: nil, timeout: nil) ⇒ Object
- #query_selector(selector) ⇒ Object
- #query_selector_all(selector) ⇒ Object
- #type_text(text, delay: nil, noWaitAfter: nil, timeout: nil) ⇒ Object
Methods inherited from JSHandle
#as_element, #dispose, #evaluate, #evaluate_handle, #get_properties, #get_property, #json_value, #off, #on, #once
Methods inherited from PlaywrightApi
#==, from_channel_owner, #initialize
Constructor Details
This class inherits a constructor from Playwright::PlaywrightApi
Instance Method Details
#click(button: nil, clickCount: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 6 def click( button: nil, clickCount: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil) params = { button: , clickCount: clickCount, delay: delay, force: force, modifiers: modifiers, noWaitAfter: noWaitAfter, position: position, timeout: timeout, }.compact @channel.('click', params) nil end |
#eval_on_selector(selector, pageFunction, arg: nil) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 66 def eval_on_selector(selector, pageFunction, arg: nil) if JavaScript.function?(pageFunction) JavaScript::Function.new(pageFunction, arg).eval_on_selector(@channel, selector) else JavaScript::Expression.new(pageFunction).eval_on_selector(@channel, selector) end end |
#eval_on_selector_all(selector, pageFunction, arg: nil) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 74 def eval_on_selector_all(selector, pageFunction, arg: nil) if JavaScript.function?(pageFunction) JavaScript::Function.new(pageFunction, arg).eval_on_selector_all(@channel, selector) else JavaScript::Expression.new(pageFunction).eval_on_selector_all(@channel, selector) end end |
#press(key, delay: nil, noWaitAfter: nil, timeout: nil) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 43 def press(key, delay: nil, noWaitAfter: nil, timeout: nil) params = { key: key, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout, }.compact @channel.('press', params) nil end |
#query_selector(selector) ⇒ Object
55 56 57 58 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 55 def query_selector(selector) resp = @channel.('querySelector', selector: selector) ChannelOwners::ElementHandle.from_nullable(resp) end |
#query_selector_all(selector) ⇒ Object
60 61 62 63 64 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 60 def query_selector_all(selector) @channel.('querySelectorAll', selector: selector).map do |el| ChannelOwners::ElementHandle.from(el) end end |
#type_text(text, delay: nil, noWaitAfter: nil, timeout: nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/playwright/channel_owners/element_handle.rb', line 31 def type_text(text, delay: nil, noWaitAfter: nil, timeout: nil) params = { text: text, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout, }.compact @channel.('type', params) nil end |