ruby on rails - Capybara not finding meta tags -


capybara 2.1.0 doesn't seem find meta tags:

(rdb:1) p page.find 'meta' *** capybara::elementnotfound exception: unable find css "meta" 

even when appear in page.source:

(rdb:1) p page.source "<!doctype html>\n<html>\n<head>\n<title>mytitle</title>\n<meta charset='utf-8'>\n<meta content='ie=edge,chrome=1' http-equiv='x-ua-compatible'>\n<meta content='width=device-width, initial-scale=1' name='viewport'>\n<meta name='description'>\n\n..." 

the solution use :visible => false either in find or in have_selector:

page.should have_css 'meta[name="description"]', :visible => false 

or:

page.find 'meta[name="description"]', :visible => false 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -