lib/capybara/shadowdom.rb in capybara-shadowdom-0.1.0 vs lib/capybara/shadowdom.rb in capybara-shadowdom-0.3.0
- old
+ new
@@ -29,11 +29,11 @@
# # Input elements within the shadow DOM will also be accessible:
# fill_in "#user_name", with: "awesome@example.org"
# end
#
def shadow_root
- root_node = evaluate_script("this.shadowRoot")
+ root_node = synchronize { evaluate_script("this.shadowRoot") }
return if root_node.nil?
node = if defined?(::Selenium::WebDriver::ShadowRoot) && root_node.is_a?(::Selenium::WebDriver::ShadowRoot)
# Selenium >= 4.1.x
@@ -59,6 +59,6 @@
::Capybara::Node::ShadowRoot.new(session, node, node, nil)
end
end
end
-::Capybara::Node::Element.include(::Capybara::ShadowDOM)
+::Capybara::Node::Element.prepend(::Capybara::ShadowDOM)