what is Scoping?

Understanding Scoping

Scoping

Let’s understand Scoping. But before we understand Scoping, let’s have a look at Capybara. It provides developers to simulate a user on a web page as well as make assertions based on the content and environment of the page. It also offers an API to interact with the web page.
To begin with, it determines the amount of data that the transformation matches against the address reference data during address validation. The following list describes all the matching scope options.

  • ALL: Validates all selected ports. Default option.
  • DELIVERY POINT: Validates building and sub-building address data in addition to data that the Street option validates.
  • Locality : validates province, locality, and postcode data.
  • Street: Validates street address data in addition to data that the Locality option validates.

 

To avoid unexpected behaviour (like ambiguous matches), it is a good practice to scope part of the DOM in which some action will be performed

within(:xpath, ‘actual_xpath’) do

fill_in ‘Name’, :with => ‘John’

end

Capybara will first search the DOM with the xpath selector. Then, inside this part of the DOM, it will do an additional search for the text field.

More importantly,  if you want to understand and have a clear view of the topic, visit the link mentioned below.

Make your resume stand out and become a Certified Capybara Testing Professional. Try free practice tests here!

A great career is just a certification away. So, practice and validate your skills to become Certified Capybara Testing Professional

Understanding Strategy
Custom Selectors

Get industry recognized certification – Contact us

keyboard_arrow_up