Note that there are some explanatory texts on larger screens.

plurals
  1. POElement not found error when using Capybara webkit but the test runs fine in non-headless mode
    primarykey
    data
    text
    <p>I am trying to run a simple google search test in the headless mode using Capybara-webkit.</p> <p>I have set the drivers as in env.rb file:</p> <pre><code>Capybara.default_driver = :webkit Capybara.current_driver = :webkit Capybara.javascript_driver = :webkit </code></pre> <p>And the feature file has a simple scenario outline which searches for a input and verifies whether the result contains the expected output:</p> <pre><code> Given User opens the google page When she searches for "&lt;input&gt;" Then verify that the result has "&lt;output&gt;" Examples: |input | output | |Agile Samurai author name|Jonathan Rasmusson| |Eloquent Ruby author name|Russ Olsen | </code></pre> <p>In the step definition, the google page is visited and the input is entered into the text box and the search button is clicked.</p> <pre><code>Given /^User opens the google page$/ do visit "http://google.com" end When /^she searches for "(.*?)"$/ do |search_query| fill_in "gbqfq", :with =&gt; search_query click_button "gbqfba" end Then /^verify that the result has "(.*?)"$/ do |output| should have_content output end </code></pre> <p>When I run these tests, I get the error:</p> <blockquote> <p>Unable to find field "gbqfq" (Capybara::ElementNotFound)</p> </blockquote> <p>But, if I change the driver to selenium:</p> <pre><code>Capybara.default_driver = :selenium Capybara.current_driver = :selenium Capybara.javascript_driver = :selenium </code></pre> <p>then, the tests run and all the steps pass.</p> <p>In the headless mode, are the elements found in some other way? Is my approach wrong? I am unable to understand why the element is not found in the headless mode when it works fine in the browser mode (that opens firefox instance).</p> <p>I am a novice in this field, so any help will be deeply appreciated. Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload