1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Pass Element#base to driver instead of #native for execute/evaluate_script args

This commit is contained in:
Thomas Walpole 2017-01-03 20:41:37 -08:00
parent 93598f1ede
commit 30d037a005
2 changed files with 4 additions and 4 deletions

View file

@ -87,11 +87,11 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
def needs_server?; true; end
def execute_script(script, *args)
browser.execute_script script, *args
browser.execute_script(script, *args.map { |arg| arg.is_a?(Capybara::Selenium::Node) ? arg.native : arg} )
end
def evaluate_script(script, *args)
browser.execute_script "return #{script}", *args
browser.execute_script("return #{script}", *args.map { |arg| arg.is_a?(Capybara::Selenium::Node) ? arg.native : arg} )
end
def save_screenshot(path, _options={})

View file

@ -611,7 +611,7 @@ module Capybara
raise Capybara::NotSupportedByDriverError, "The current driver does not support arguments being passed with execute_script" unless args.empty?
driver.execute_script(script)
else
driver.execute_script(script, *args.map { |arg| arg.is_a?(Capybara::Node::Element) ? arg.native : arg} )
driver.execute_script(script, *args.map { |arg| arg.is_a?(Capybara::Node::Element) ? arg.base : arg} )
end
end
@ -630,7 +630,7 @@ module Capybara
raise Capybara::NotSupportedByDriverError, "The current driver does not support arguments being passed with execute_script" unless args.empty?
driver.evaluate_script(script)
else
driver.evaluate_script(script, *args.map { |arg| arg.is_a?(Capybara::Node::Element) ? arg.native : arg} )
driver.evaluate_script(script, *args.map { |arg| arg.is_a?(Capybara::Node::Element) ? arg.base : arg} )
end
end