本文介绍了webdriver API:如何禁用详细错误消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下示例源上运行

运行成功,但是Eclipse抛出了一系列警告消息。如何禁用此显示?我真正需要的是最后一行页面标题是:Cheese! -Google搜索

It runs successfully, however Eclipse throws bunch of WARNING messages. How Can I disable this from displaying ? All I really need is the last line Page title is: Cheese! - Google Search

17-Aug-2010 12:07:00 AM com.gargoylesoftware.htmlunit.util.StringUtils parseHttpDate
WARNING: Unable to parse date: -1
17-Aug-2010 12:07:00 AM com.gargoylesoftware.htmlunit.util.StringUtils parseHttpDate
WARNING: Unable to parse date: -1
17-Aug-2010 12:07:01 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: null [1:4686] Error in style rule. Invalid token "*". Was expecting one of: <S>, "}", ";", <IDENT>.
17-Aug-2010 12:07:01 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warning
WARNING: CSS warning: null [1:4686] Ignoring the following declarations in this rule.
17-Aug-2010 12:07:01 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: null [1:6505] Error in expression. Invalid token ";". Was expecting one of: <S>, <PLUS>, "-", <HASH>, <STRING>, <URI>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMENSION>, <PERCENTAGE>, <NUMBER>, <FUNCTION>, <IDENT>.
Page title is: Cheese! - Google Search


推荐答案

zloiadun给出的答案没有在这里工作,而不是我不得不使用

The answer given by zloiadun didn't work here, instead I had to use,

Logger logger = Logger.getLogger ("");
logger.setLevel (Level.OFF);

..根据需要更改getLogger(..)和级别。

.. changing the getLogger( .. ) and level as needed.

这篇关于webdriver API:如何禁用详细错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:56