youtube视频中的Phantom JS错误

时间:2014-01-29 17:53:21

标签: ruby-on-rails rspec capybara phantomjs poltergeist

Phantom JS版本:1.9.1 恶作剧版本:1.3.0

从今天开始,youtube嵌入式视频现在在运行javascript测试时出现了一个恶作剧错误。我的youtube代码只是默认的嵌入youtube代码。这是一个例子:

<iframe width="560" height="315" src="//www.youtube.com/embed/AW9Z3cGOlGM?rel=0" frameborder="0" allowfullscreen></iframe>

我在启用javascript时访问该页面时遇到的错误是:

 Failure/Error: page.find(".container.registrations.false.government")["style"].should have_content("test.jpg")
 Capybara::Poltergeist::JavascriptError:
   One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).

   TypeError: 'null' is not an object (evaluating 'a.dataset')
       at http://s.ytimg.com/yts/jsbin/www-embed-player-vfl6vSff7.js:97
       at http://s.ytimg.com/yts/jsbin/www-embed-player-vfl6vSff7.js:88 in vg
       at http://s.ytimg.com/yts/jsbin/www-embed-player-vfl6vSff7.js:85
       at http://s.ytimg.com/yts/jsbin/www-embed-player-vfl6vSff7.js:98

同样在一些测试中,吵闹鬼只是死了..

 Failure/Error: visit root_path
 Capybara::Poltergeist::DeadClient:
   PhantomJS client died while processing {"name":"visit","args":["http://subdomain13.lvh.me:3003/"]}

此外,它在执行以下操作时不会忽略这些错误:

Capybara.register_driver :poltergeist_without_js do |app|
  Capybara::Poltergeist::Driver.new(app, :js_errors => false)
end
Capybara.javascript_driver = :poltergeist_without_js

1 个答案:

答案 0 :(得分:2)

这是嵌入JS处理不支持flash或html5视频的浏览器的错误:

https://productforums.google.com/d/topic/youtube/2Cu87teAGYE/discussion

的讨论

https://code.google.com/p/gdata-issues/issues/detail?id=5883

上的错误报告