Advanced DSL

Understanding Advanced DSL

Image result for advanced DSL

Let’s understand Advanced DSL. But before this, let’s have a look at Capybara. So, Capybara 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. For scenarios where basic the DSL cannot help, we use xpath and CSS selectors (CSS selectors will be used by default). This is very common, since modern web applications usually have a lot of JavaScript code that generates HTML elements with attributes that have generated values (like random ids, etc.)

To find a specific element and click on it we can use:

find(‘xpath/css’).click

To get text from specific element use:

find(‘xpath/css’).text

To use xpath selectors, simply change the following configuration value:

Capybara.default_selector = :xpath

The selector type can be specified, if necessary:

find(:xpath, ‘actual_xpath’)

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

Using the DSL elsewhere
DSL Summary

Get industry recognized certification – Contact us

keyboard_arrow_up