Not sure if I am doing something wrong, but It seems that capybara can't find the element 'head'
(rdb:1) find(:xpath, '//body')
#<Capybara::Element tag="body" path="/html/body">
(rdb:1) find(:xpath, '//head')
*** Capybara::ElementNotFound Exception: Unable to find xpath "//head"
To make sure, I tried to bring the html down to this:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
I am using capybara 2.1.0
The head element is usually invisible, the default has changed in Capybara 2.1.0 to by default not find hidden elements, you need to pass :visible => false or set Capybara.ignore_hidden_elements = false.
awesome! thank you very much
worked for me as well.
Most helpful comment
The head element is usually invisible, the default has changed in Capybara 2.1.0 to by default not find hidden elements, you need to pass
:visible => falseor setCapybara.ignore_hidden_elements = false.