Is there a way to view PhantomJS console.log messages via Selenium/GhostDriver?

kelveden picture kelveden · Oct 7, 2013 · Viewed 10.3k times · Source

I'm using the Java bindings of GhostDriver to run Selenium acceptance tests against PhantomJS.

If one of the web pages requested by PhantomJS logs to the Javascript console via console.log, is there a way to capture or view those messages?

I'm guessing that the answer to this is forehead-slappingly simple but I can't work it out!

Answer

lukeis picture lukeis · Jan 7, 2014
LogEntries logs = driver.manage().logs().get("browser");