有没有一种方法可以通过Selenium/GhostDriver查看PhantomJS console.log消息? [英] Is there a way to view PhantomJS console.log messages via Selenium/GhostDriver?

查看:153
本文介绍了有没有一种方法可以通过Selenium/GhostDriver查看PhantomJS console.log消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GhostDriver 的Java绑定对PhantomJS运行Selenium接受测试.

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

如果PhantomJS请求的网页之一通过console.log登录到Javascript控制台,是否可以捕获或查看这些消息?

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!

推荐答案

LogEntries logs = driver.manage().logs().get("browser");

这篇关于有没有一种方法可以通过Selenium/GhostDriver查看PhantomJS console.log消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆