Capybara: Capybara can't find element head

Created on 16 Apr 2013  路  3Comments  路  Source: teamcapybara/capybara

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

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 => false or set Capybara.ignore_hidden_elements = false.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasnow picture jasnow  路  8Comments

kiddrew picture kiddrew  路  10Comments

1c7 picture 1c7  路  3Comments

stevebooks picture stevebooks  路  10Comments

Souravgoswami picture Souravgoswami  路  8Comments