jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

console.log on selenium does not print when running the CLI #356

Closed mikepack closed 9 years ago

mikepack commented 9 years ago

Selenium doesn't provide support for accessing console.logs.

One way around this would be to override console.log to call Teaspoon.hook, like this:

console.log = function() {
  Teaspoon.hook("log", {messages: arguments});
}

Calling console.log will call the hook defined in your teaspoon_env.rb, which could then print out the message:

suite.hook :log do |payload|
  payload.messages.each do |message|
    puts message
  end
end
EddieOne commented 3 years ago

Is that the solution or the question? I am facing the same problem.