Phil
Phil

Reputation: 916

Using Capybara finder on HTML block

I had my Selenium tests navigating to a public dummy inbox to verify receipt of email deliveries and would perform some confirmation workflows there (password change, etc). It was becoming far too slow and unreliable.

I'm now using the API of a mail service to retrieve an email message. I'm able to search for the message I need and I'm able to retrieve the block of HTML that I'm usually inspecting.

Is there a way to use a Capybara finder on a block of HTML text?

Upvotes: 0

Views: 28

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49870

You can turn a string of html into something Capybara can work with by doing

node = Capybara.string(the_html.to_s)

then you can call finders on node

node.find(...)

Upvotes: 1

Related Questions