What's the use of section in siteprism?

158    Asked by AnishaDalal in Cyber Security , Asked on Apr 20, 2022

 I have been doing selenium automation in C# for almost 1 year. I need to learn siteprism using capybara. When I was going through the documentation of siteprism i can't relate sections with page objects.


I have implemented annotations and pagefactory. But I cannot relate sections in siteprism with anything in selenium.

Answered by Anil Jha

SitePrism gives you a simple, clean and semantic DSL for describing your site using the Page Object Model pattern, for use with Capybara in automated acceptance testing. Before we go into SitePrism, let’s talk about page objects, because page objects are central to understanding the philosophy behind SitePrism. A Page Objects Primer Page Objects encapsulate the implementation details of the page (in our example, an HTML document) and expose a specific API that allows you, the tester, to test elements on the page. This encapsulation of details makes page objects especially handy as a testing tool.

Let’s illustrate this with an example. Here, we have a page object that inherits from the SitePrism::Page class:

(class LoginPage < SitePrism input[name='username' input[name='password' xss=removed> 3.0.0'
  gem 'capybara-rails'
  gem 'site_prism'
  # ...
end )

Note that for the example project, we are going to use RSpec 3. Also, you will need Capybara in order to use SitePrism.


Your Answer

Interviews

Parent Categories