如何解决这个Javascript错误TypeError:'undefined'不是一个对象(评估't.subscribe')?

时间:2013-03-01 10:08:25

标签: javascript ruby-on-rails ruby capybara poltergeist

当我点击一个项目在网上打开时发生以下错误。我们中的任何人都知道解决方案吗?

  

错误:   test_inline_edit_an_item_app_built_via_app_builder(TaskFeature):   Capybara :: Poltergeist :: JavascriptError:页面上的Javascript代码中引发了一个或多个错误。如果您不关心这些错误,可以通过在Poltergeist配置中设置js_errors:false来忽略它们(详见文档)。


  

TypeError:'undefined'不是对象(评估't.subscribe')   在https://d3tga9h80dykic.cloudfront.net/assets/cd319648/podio-common-amd.js:1   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/poltergeist-1.1.0/lib/capybara/poltergeist/browser.rb:197:in command'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/poltergeist-1.1.0/lib/capybara/poltergeist/browser.rb:42:infind”   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/poltergeist-1.1.0/lib/capybara/poltergeist/driver.rb:110:in find'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/node/finders.rb:113:inblock in all'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/node/base.rb:78:in synchronize'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/node/finders.rb:112:inall”   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/node/finders.rb:26:in block in find'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/node/base.rb:78:insynchronize”   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/node/finders.rb:26:in find'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/session.rb:341:inblock(2个级别)在课堂上:Session'   /home/abhay/.rvm/gems/ruby-1.9.3-p362/gems/capybara-2.0.2/lib/capybara/dsl.rb:51:in block(2 levels)in'   task_feature.rb:489:test_inline_edit_an_item_app_built_via_app_builder'中的inblock   /home/abhay/podio/auto_deetee/auto_deetee/test/test_helper.rb:69:in login_as'   task_feature.rb:473:intest_inline_edit_an_item_app_built_via_app_builder'

1次测试,0次断言,0次失败,1次错误,0次跳过

1 个答案:

答案 0 :(得分:12)

当Poltergeist在您正在测试的页面上检测到Javascript错误时,会发生此错误。 Poltergeist这样做是为了确保您的网站上有无错误的Javascript代码(这是大多数人想要的)。

但是,有些人不希望收到有关Javascript错误的通知。因此,您可以使用the js_errors: false option来消除此错误。 (但这不会修复你的Javascript。)