I need to do something like this
if js_enalbed?
accept_confirm do
delete_button.click()
end
else
delete_button.click()
end
This makes the test work with any driver - both drivers supporting js and drivers that do not support js.
How could you check if js is enabled?
I have done this for very long, but I am wondering if someone knows a better option
def js_enabled?
[:selenium, :selenium_headless, :selenium_chrome, :selenium_chrome_headless, :firefox_headless, :firefox].include?(Capybara.current_driver)
end
I have also used
Capybara.current_driver == Capybara.javascript_driver
in certain spec, but it is not working with the DRIVEN_BY and so on