Search code examples
rubyrspecpage-object-gemsite-prism

Difference between these two gems "site_prism" and "page_object"


I have come across two projects one is with WATIR cucumber feature files and step definitions and another one is Rspec, capybara`` withoutstep definitionsandfeature files`.

In WATIR project page_object was used and in capybara site_prism gem was used.

  1. What is the difference between two?
  2. Can't we use page_object in capybara would that be incorrect approach? Why?

Solution

  • The main difference between the two is supported underlying drivers, which is the part that actually interacts with the browser.

    • SitePrism supports Capybara.
    • Page-Object supports Watir-Webdriver and Selenium-Webdriver.

    As each gem makes assumptions about the API of the driver, you cannot use unsupported drivers - ie you cannot use the Page-Object gem with Capybara.

    Aside from that, it is mainly API preferences. Both gems are for creating page object models. However, the syntax for defining the page object and the methods the page object has will differ based on the preferences of each gem's author.