Skip to Main Content
Cucumber Recipes
book

Cucumber Recipes

by Ian Dees, Matt Wynne, Aslak Hellesoy
February 2013
Intermediate to advanced content levelIntermediate to advanced
272 pages
5h 45m
English
Pragmatic Bookshelf
Content preview from Cucumber Recipes
Recipe 30Parse HTML Tables

Problem

You’re testing a web page containing tabular data (or any repeating data, really), and you need to compare the contents to a table in your Cucumber scenario.

Ingredients

  • Capybara[193] for testing web applications

  • Capybara’s arsenal of finders[194] for traversing patterns in HTML

  • XPath[195] for describing the locations of objects on the page

Solution

Capybara is a Ruby web testing library. It provides a simple API for visiting web pages and parsing the results. Behind the scenes, Capybara will either launch a real browser (for non-Ruby web apps) or call directly into the server code (for Ruby apps built on Rails, Sinatra, or any other Rack framework).

In this recipe, you’ll serve a simple static site ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Cucumber Cookbook

Cucumber Cookbook

Shankar Garg
Basiswissen Softwaretest , 6th Edition

Basiswissen Softwaretest , 6th Edition

Andreas Spillner, Tilo Linz
React Cookbook

React Cookbook

David Griffiths, Dawn Griffiths

Publisher Resources

ISBN: 9781941222607Errata