Skip to content

How to turn off htmlunit logging? #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
php-coder opened this issue Apr 30, 2019 · 3 comments
Closed

How to turn off htmlunit logging? #65

php-coder opened this issue Apr 30, 2019 · 3 comments

Comments

@php-coder
Copy link

When I run robot tests (that uses https://github.com/Hi-Fi/robotframework-seleniumlibrary-java and htmlunit), I see the messages from htmlunit and I didn't find a way on how to turn them off.

Example:

$ mvn robotframework:run  -Dincludes=testme
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< ru.mystamps:mystamps >------------------------
[INFO] Building My Stamps 0.3-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- robotframework-maven-plugin:1.4.7:run (default-cli) @ mystamps ---
==============================================================================
Robotframework
==============================================================================
Robotframework.Country
==============================================================================
Robotframework.Country.Access :: Verify access to country related pages (in...
==============================================================================
[ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://127.0.0.1:8080/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0]
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.4.1/css/bootstrap.min.css' [5:56309] Error in expression; ':' found after identifier "progid".
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.4.1/css/bootstrap.min.css' [5:114102] Error in expression; ':' found after identifier "progid".
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.4.1/css/bootstrap.min.css' [5:114645] Error in expression; ':' found after identifier "progid".
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.4.1/css/bootstrap.min.css' [5:115813] Invalid color "#000\9".
Anonymous user cannot create country                                  [ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://127.0.0.1:8080/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0]
| PASS |
------------------------------------------------------------------------------
Opening a page of non-existing country show an error                  [ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://127.0.0.1:8080/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0]
| PASS |
------------------------------------------------------------------------------
Robotframework.Country.Access :: Verify access to country related ... | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
...

I have the src/test/resources/logback-test.xml file that turns them off but it didn't take into an action. Also, I'm not fully sure whether it's a plugin's responsibility or the robotframework-seleniumlibrary-java.

How I can disable these messages?

@php-coder
Copy link
Author

I'm not fully sure whether it's a plugin's responsibility or the robotframework-seleniumlibrary-java

@Hi-Fi Perhaps, you have thoughts on that? I'd be grateful for help!

@Hi-Fi
Copy link
Contributor

Hi-Fi commented Jan 4, 2020

I think this should be handled at the SeleniumLibrary side. Maven plugin doesn't make any actions to other logging than RF level (and mentioned one is coming directly to stdout).

@Hi-Fi Hi-Fi closed this as completed Jan 4, 2020
@php-coder
Copy link
Author

An update in case it can be helpful to someone else:

The loglevel is set and managed by Maven. Here is the details: https://maven.apache.org/maven-logging.html It uses slf4j and SimpleLogger by default. In order to suppress annoying htmlunit messages, I passed the following options:

-Dorg.slf4j.simpleLogger.log.com.gargoylesoftware.htmlunit.DefaultCssErrorHandler=error
-Dorg.slf4j.simpleLogger.log.com.gargoylesoftware.htmlunit.html.InputElementFactory=warn
-Dorg.slf4j.simpleLogger.log.com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl=error

In order to use them always and by default, I put these lines into .m2/jvm.config file within a project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants