SeleniumLibrary
SeleniumLibrary copied to clipboard
Wait Until Element Is Visible and Wait Until Element Is Not Visible log about 45 kilobytes of JS code on DEBUG level
For issues
Steps to reproduce the issue
Can be reproduced with at least Chrome and Firefox.
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Test Case
Open Browser https://robotframework.org/ firefox
Wait Until Element Is Visible introduction
Close Browser
Error messages and additional information
JavaScript code seems to originate from C:\Python37\Lib\site-packages\selenium\webdriver\remote\isDisplayed.js
Expected behavior and actual behavior
Expected behavior: visibility would be checked without logging JavaScript code.
Actual behavior: 45 056 bytes of JavaScript is logged each time Wait Until Element Is Visible or Wait Until Element Is Not Visible is called. Our recent log file exceeded 500 megabytes in size because these keywords were called over 10,000 times during the test run.
This is relatively new change as I don't remember seeing this in spring 2019.
Environment
Browser: Chrome 78, Firefox 70 Browser driver: ChromeDriver 78, GeckoDriver 0.26.0 Operating System: Windows 10 Libraries
- Robot Framework: 3.1.2
- Selenium: 3.141.0
- SeleniumLibrary: 4.1.0
- Interpreter: Python 3.7.4
This seems to work as a quick workaround but it would be nice if users of SeleniumLibrary wouldn't need to do this.
Wait Until Element Is Not Visible Quietly
[Arguments] ${id} ${timeout}=None
${level} Set Log Level INFO
Wait Until Element Is Not Visible ${id} timeout=${timeout}
Set Log Level ${level}
Wait Until Element Is Visible Quietly
[Arguments] ${id} ${timeout}=None
${level} Set Log Level INFO
Wait Until Element Is Visible ${id} timeout=${timeout}
Set Log Level ${level}
The logging which causes the problem is generated by the underlying Selenium (or some other Python library that Selenium uses) and it can not directly controlled by the SeleniumLibrary. But getting the logger from the downstream libraries, example like in this stackoverflow and setting the loglevel to something which prevent the logging to be visible could be doable. Needs some investigation.
@VilleSalonen do you think that it would sufficient to control in a library level? There perhaps could be import level argument and a new keywords to set the Selenium level logging to something. Example something like this:
*** Settings ***
Library SeleniumLibrary selenium_log_level=INFO
*** Test Cases ***
Example
Set Selenium Log Level CRITICAL
Open Browser ${URL} chrome
[Teardown] Close All Brows
And if test case is run with --logelvel trace
from command line, it would not log anything from Selenium side. What do you think?
I think your proposal would be very good.
@colourmein13 it's not visible on the log level you used
@colourmein13 it's not visible on the log level you used
Yep, realized that a second after I posted.