Search code examples
rubycapybarapage-object-gem

Capybara vs Page Object


I'm currently using Cucumber and Ruby Page Object for testing my Ruby on Rails website.

I'm trying to understand Capybara and decide if I should add it to the mix, or maybe replace Page Object with it.

I'd appreciate if somebody provides more insights into benefits of using Capybara when compared to Page Object, and does it make sense to use them together?


Solution

  • You cannot use Cheezy's page-object gem with Capybara.

    The page-object gem only supports Watir-Webdriver and Selenium-WebDriver. It does not support Capybara.

    Capybara, Watir and Selenium are for driving browsers while page-object is for modelling your pages. If you switch to Capybara, you would need to pick a different page-object library such as SitePrism. Switching would mean you either need to support two completely separate stacks or re-write your existing tests.