检查Ruby上的浏览器控制台输出 [英] Check browser console output on Ruby
问题描述
如何检查浏览器控制台中的错误?
How can I check a browser console for errors?
例如,我使用Selenium提升了浏览器(firefox的镶边),并使用Selenium WebDriver进行了一些操作.之后,我想知道Web控制台中是否有任何错误.
For example, I have raised browser(chrome of firefox) with Selenium and I have done some actions with Selenium WebDriver. After than I want to know is there any error in the web console.
推荐答案
硒红宝石gem的2.38版公开了日志记录API.
Version 2.38 of the selenium ruby gem exposes the logging API.
http://selenium.googlecode.com/git/rb/CHANGES
这使您可以访问chrome控制台日志.
This allows you to access the chrome console logs.
https://code.google.com/p/selenium/wiki/Logging
这是Java中的一个示例,但您应该能够轻松地转换为ruby;
Here is an example in Java but you should be able to translate easily to ruby;
这篇关于检查Ruby上的浏览器控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!