Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Capybara::Poltergeist::DeadClient when JS errors are thrown #232

@pfleidi

Description

@pfleidi

Hello,

Some days ago one of our tests using poltergeist started to fail with Capybara::Poltergeist::DeadClient errors.

Here's the code causing the error:

  within(:css, "form#node-type-form") do
    fill_in("name", :with => content_type)
    fill_in("description", :with => description)
    click_button("edit-submit")
  end

And here's the shell output:

      The PhantomJS client died while processing {"args":[2,3],"name":"click"} (Capybara::Poltergeist::DeadClient)
      (eval):2:in `send'
      (eval):2:in `click_button'
      ./features/step_definitions/content_creation_steps.rb:17
      ./features/step_definitions/content_creation_steps.rb:14:in `/^I create a content type named ["']([^"']+)["'] with description ["']([^"']+)["']$/'
      features/fivestar.feature:24:in `And I create a content type named "fivestar-01" with description "fivestar type"'

My current setup looks like this:

  • Ruby 1.8.7
  • Cucumber (1.2.1)
  • Capybara (1.1.3)
  • Poltergeist (1.0.2)
  • PhantomJS 1.8.1

I am running my tests on OS X 10.8 and Ubuntu 8.04.4 LTS. The js_errors option is set to false:

  options = {
    :js_errors => false,
    :window_size => [1280, 768],
    :debug => true
  }

After debugging the problem a bit more, I found out that a JS error is thrown when loading the site:

{"args"=>["http:/my.site/path"], "name"=>"visit"}
{"error"=>{"args"=>[[{"stack"=>"TypeError: 'undefined' is not an object (evaluating 'jQuery.timeago.settings')\n    at http://my.site/sites/all/modules/timeago/timeago.js?mgexlw:13", "message"=>"TypeError: 'undefined' is not an object (evaluating 'jQuery.timeago.settings')"}]], "name"=>"Poltergeist.JavascriptError"}}
Capybara::Poltergeist::JavascriptError
{"args"=>[".//body[contains(concat(' ', @class, ' '), ' logged-in ')]"], "name"=>"find"}
{"response"=>{"ids"=>[0], "page_id"=>1}}

After fixing the JS error, the test started working again. So the crash is probably caused by the uncaught error.

I also created a a crashdump of phantomJS.

It currently looks like phantomJS dies after encountering a JS error when js_error is set to false.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions