Understanding Scoping

Understanding Scoping

Scoping

 

Let’s start understanding Scoping. Capybara makes it possible to restrict certain actions, such as interacting with forms or clicking links and buttons, to within a specific area of the page. For this purpose, you can use the generic within a method. Optionally you can specify which kind of selector to use.

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. Also,  let’s check out DSL.

DSL stands for Digital Subscriber Line. Moreover, users get a high-speed bandwidth connection from a phone wall jack on an existing telephone network. Not to mention, it also works within the frequencies that the telephone doesn’t so you can use the Internet while making phone calls. DSL utilizes telephone wires, which makes sense that the biggest providers are telephone companies.

Now, let’s understand this section.

within(“li#employee”) do

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

end

 

within(:xpath, “//li[@id=’employee’]”) do

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

end

There are special methods for restricting the scope to a specific fieldset, identified by either an id or the text of the fieldset’s legend tag, and to a specific table, identified by either id or text of the table’s caption tag.

within_fieldset(‘Employee’) do

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

end

 

within_table(‘Employee’) do

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

end

Make your resume stand out and become a Certified Capybara Testing Professional. So, 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

Finding
Scripting

Get industry recognized certification – Contact us

keyboard_arrow_up