class Playwright::ChannelOwners::ElementHandle
Public Instance Methods
as_element()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 6 def as_element self end
bounding_box()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 271 def bounding_box @channel.send_message_to_server('boundingBox') end
check(force: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 245 def check(force: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil) params = { force: force, noWaitAfter: noWaitAfter, position: position, timeout: timeout, trial: trial, }.compact @channel.send_message_to_server('check', params) nil end
checked?()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 36 def checked? @channel.send_message_to_server('isChecked') end
click( button: nil, clickCount: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 92 def click( button: nil, clickCount: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil) params = { button: button, clickCount: clickCount, delay: delay, force: force, modifiers: modifiers, noWaitAfter: noWaitAfter, position: position, timeout: timeout, trial: trial, }.compact @channel.send_message_to_server('click', params) nil end
content_frame()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 15 def content_frame resp = @channel.send_message_to_server('contentFrame') ChannelOwners::Frame.from_nullable(resp) end
dblclick( button: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 119 def dblclick( button: nil, delay: nil, force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil) params = { button: button, delay: delay, force: force, modifiers: modifiers, noWaitAfter: noWaitAfter, position: position, timeout: timeout, trial: trial, }.compact @channel.send_message_to_server('dblclick', params) nil end
disabled?()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 40 def disabled? @channel.send_message_to_server('isDisabled') end
dispatch_event(type, eventInit: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 60 def dispatch_event(type, eventInit: nil) params = { type: type, eventInit: JavaScript::ValueSerializer.new(eventInit).serialize, }.compact @channel.send_message_to_server('dispatchEvent', params) nil end
editable?()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 44 def editable? @channel.send_message_to_server('isEditable') end
enabled?()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 48 def enabled? @channel.send_message_to_server('isEnabled') end
eval_on_selector(selector, pageFunction, arg: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 310 def eval_on_selector(selector, pageFunction, arg: nil) JavaScript::Expression.new(pageFunction, arg).eval_on_selector(@channel, selector) end
eval_on_selector_all(selector, pageFunction, arg: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 314 def eval_on_selector_all(selector, pageFunction, arg: nil) JavaScript::Expression.new(pageFunction, arg).eval_on_selector_all(@channel, selector) end
fill(value, force: nil, noWaitAfter: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 183 def fill(value, force: nil, noWaitAfter: nil, timeout: nil) params = { value: value, force: force, noWaitAfter: noWaitAfter, timeout: timeout, }.compact @channel.send_message_to_server('fill', params) nil end
focus()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 215 def focus @channel.send_message_to_server('focus') nil end
get_attribute(name)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 20 def get_attribute(name) @channel.send_message_to_server('getAttribute', name: name) end
hover(force: nil, modifiers: nil, position: nil, timeout: nil, trial: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 79 def hover(force: nil, modifiers: nil, position: nil, timeout: nil, trial: nil) params = { force: force, modifiers: modifiers, position: position, timeout: timeout, trial: trial, }.compact @channel.send_message_to_server('hover', params) nil end
inner_html()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 32 def inner_html @channel.send_message_to_server('innerHTML') end
inner_text()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 28 def inner_text @channel.send_message_to_server('innerText') end
input_value(timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 202 def input_value(timeout: nil) params = { timeout: timeout }.compact @channel.send_message_to_server('inputValue', params) end
owner_frame()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 10 def owner_frame resp = @channel.send_message_to_server('ownerFrame') ChannelOwners::Frame.from_nullable(resp) end
press(key, delay: nil, noWaitAfter: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 233 def press(key, delay: nil, noWaitAfter: nil, timeout: nil) params = { key: key, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout, }.compact @channel.send_message_to_server('press', params) nil end
query_selector(selector)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 299 def query_selector(selector) resp = @channel.send_message_to_server('querySelector', selector: selector) ChannelOwners::ElementHandle.from_nullable(resp) end
query_selector_all(selector)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 304 def query_selector_all(selector) @channel.send_message_to_server('querySelectorAll', selector: selector).map do |el| ChannelOwners::ElementHandle.from(el) end end
screenshot( omitBackground: nil, path: nil, quality: nil, timeout: nil, type: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 275 def screenshot( omitBackground: nil, path: nil, quality: nil, timeout: nil, type: nil) params = { omitBackground: omitBackground, path: path, quality: quality, timeout: timeout, type: type, }.compact encoded_binary = @channel.send_message_to_server('screenshot', params) decoded_binary = Base64.strict_decode64(encoded_binary) if path File.open(path, 'wb') do |f| f.write(decoded_binary) end end decoded_binary end
scroll_into_view_if_needed(timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 70 def scroll_into_view_if_needed(timeout: nil) params = { timeout: timeout, }.compact @channel.send_message_to_server('scrollIntoViewIfNeeded', params) nil end
select_option( element: nil, index: nil, value: nil, label: nil, force: nil, noWaitAfter: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 144 def select_option( element: nil, index: nil, value: nil, label: nil, force: nil, noWaitAfter: nil, timeout: nil) base_params = SelectOptionValues.new( element: element, index: index, value: value, label: label, ).as_params params = base_params.merge({ force: force, noWaitAfter: noWaitAfter, timeout: timeout }.compact) @channel.send_message_to_server('selectOption', params) end
select_text(force: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 195 def select_text(force: nil, timeout: nil) params = { force: force, timeout: timeout }.compact @channel.send_message_to_server('selectText', params) nil end
set_input_files(files, noWaitAfter: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 207 def set_input_files(files, noWaitAfter: nil, timeout: nil) file_payloads = InputFiles.new(files).as_params params = { files: file_payloads, noWaitAfter: noWaitAfter, timeout: timeout }.compact @channel.send_message_to_server('setInputFiles', params) nil end
tap_point( force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 162 def tap_point( force: nil, modifiers: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil) params = { force: force, modifiers: modifiers, noWaitAfter: noWaitAfter, position: position, timeout: timeout, trial: trial, }.compact @channel.send_message_to_server('tap', params) nil end
text_content()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 24 def text_content @channel.send_message_to_server('textContent') end
type(text, delay: nil, noWaitAfter: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 221 def type(text, delay: nil, noWaitAfter: nil, timeout: nil) params = { text: text, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout, }.compact @channel.send_message_to_server('type', params) nil end
uncheck(force: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 258 def uncheck(force: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil) params = { force: force, noWaitAfter: noWaitAfter, position: position, timeout: timeout, trial: trial, }.compact @channel.send_message_to_server('uncheck', params) nil end
visible?()
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 56 def visible? @channel.send_message_to_server('isVisible') end
wait_for_element_state(state, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 318 def wait_for_element_state(state, timeout: nil) params = { state: state, timeout: timeout }.compact @channel.send_message_to_server('waitForElementState', params) nil end
wait_for_selector(selector, state: nil, timeout: nil)
click to toggle source
# File lib/playwright/channel_owners/element_handle.rb, line 325 def wait_for_selector(selector, state: nil, timeout: nil) params = { selector: selector, state: state, timeout: timeout }.compact resp = @channel.send_message_to_server('waitForSelector', params) ChannelOwners::ElementHandle.from_nullable(resp) end