Search code examples
rubyseleniumcucumbercapybarapage-object-gem

Is it Mandatory to use Capybara over Selenium when creating Page Object Automation framework in Ruby?


I am new to Ruby world and currently learning/creating a PageObject automation framework using Cucumber and Ruby scripting.

I know that using capybara will help me using different browser driver and headless driver easily. So is it something which is must to be used or Selenium as standalone can handle such scenario.


Solution

  • No, it's not mandatory. In fact, capybara allows selenium as a driver.

    Here's a way to look at it:

    cucumber is a BDD tool that allows stakeholders to write human-readable, executable product specifications, which also serve as living documentation. Separately, the Page Object model organizes product page (or features) into classes with methods that represent the page/feature functionality.

    But something needs to programmatically drive browser. There are more than a few options (e.g. selenium-webdriver, capybara, watir-webdriver) that would help you create a ruby/cucumber/page_object framework.