Modals

Understanding Modals

Modals

 

Let’s understand Modals.

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. In drivers which support it, you can accept, dismiss and respond to alerts, confirms and prompts.

Further, you can accept or dismiss alert messages by wrapping the code that produces an alert in a block:

accept_alert do

click_link(‘Show Alert’)

end

Moreover, you can accept or dismiss a confirmation by wrapping it in a block, as well:

dismiss_confirm do

click_link(‘Show Confirm’)

end

Not to mention, you can accept or dismiss prompts as well, and also provide text to fill in for the response:

accept_prompt(with: ‘Linus Torvalds’) do

click_link(‘Show Prompt About Linux’)

end

In the same vein, all modal methods return the message that was presented. So, you can access the prompt message by assigning the return to a variable:

message = accept_prompt(with: ‘Linus Torvalds’) do

click_link(‘Show Prompt About Linux’)

end

expect(message).to eq(‘Who is the chief architect of Linux?’)

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

Scripting
Using the DSL elsewhere

Get industry recognized certification – Contact us

keyboard_arrow_up