17
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Capybara+ChromeでJavaScriptのエラーを出力

Posted at

headless Chromeを使ったテストで、JavaScriptのエラーのせいで先に進まないときは、次のコードを埋め込んでコンソールの内容を調べられます。

puts page.driver.browser.manage.logs.get(:browser).collect(&:message)

get(:browser)が返すのは、Selenium::WebDriver::LogEntryオブジェクトの配列です。

JavaScriptのconsole.errorconsole.warnの内容も出力できます。console.logconsole.infoconsole.debugの内容は出せません。

17
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?