Posts

Showing posts from June, 2014

Execute JavaScript + Capybara

There are certain cases where we need some custom JavaScript while writing some Integration test cases. For such cases you can use page.execute_script. For Example page.execute_script("$('#blog-hover-#{blog.id}').show();")

Setting the size of Browser Window + Selenium and Capybara

window = Capybara.current_session.driver.browser.manage.window window.resize_to(1200, 800) You can add this inside setup block. class CapybaraIntegrationTest < ActionDispatch::IntegrationTest # Make the Capybara DSL available in all integration tests include Capybara::DSL setup do window = Capybara.current_session.driver.browser.manage.window window.resize_to(1250, 800) end end