Class: Capybara::NodeActionsAllowLabelClickPatch::SelectableElementHandler
- Inherits:
-
Object
- Object
- Capybara::NodeActionsAllowLabelClickPatch::SelectableElementHandler
- Defined in:
- lib/capybara/playwright/node.rb
Instance Method Summary collapse
-
#initialize(node:, node_type:, locator:, checked:) ⇒ SelectableElementHandler
constructor
A new instance of SelectableElementHandler.
- #set_checked_state_via_label? ⇒ Boolean
Constructor Details
#initialize(node:, node_type:, locator:, checked:) ⇒ SelectableElementHandler
Returns a new instance of SelectableElementHandler.
35 36 37 38 39 40 |
# File 'lib/capybara/playwright/node.rb', line 35 def initialize(node:, node_type:, locator:, checked:) @node = node @node_type = node_type @locator = locator @checked = checked end |
Instance Method Details
#set_checked_state_via_label? ⇒ Boolean
42 43 44 45 46 47 48 49 50 |
# File 'lib/capybara/playwright/node.rb', line 42 def set_checked_state_via_label? playwright_checkable = find_playwright_element_handle_by_non_label_locator playwright_checkable ||= playwright_locator_by_label unless @locator.nil? return false unless playwright_checkable click_associated_label?(playwright_checkable) rescue Capybara::ElementNotFound, Capybara::ExpectationNotMet, ::Playwright::Error false end |