I have tried using --removekeywords name:Login(keyword)
in the command line but the log.html
file doesn't hide the keyword.
Can anyone please help me out at least to flatten the Login
keyword in log.html
file
If you want to hide credentials, there are two things you should do. First, make sure the credentials are stored in variables rather than hard-coded in the call to the Login
keyword.
Second, use --removekeywords
to remove the Login
keyword from the log and report files. Note that the name you give to --removekeywords
must match the full name of the keyword.
For example, let's imagine you have a resource file named Keywords.robot
that defines your Login
keyword:
# Keywords.robot
*** Keywords ***
Login
[Arguments] ${username} ${password}
log your super secret password is ${password}
Now, consider a test case that uses this keyword:
# example.robot
*** Settings ***
Resource Keywords.robot
*** Variables ***
${Username} [email protected]
${Password} SuperSecret!
*** Test cases ***
Example
do something
login ${username} ${password}
do something else
If you do not use --removekeywords
, the log will show this:
If you use --removekeywords NAME:Keywords.Login
then you will see this:
You can use custom keyword for all sensitive inputs which will work just as "Input Text" (selenium library) accepting the same arguments but not logging into output.xml
Sensitive Input
Set Log Level NONE
[Arguments] ${locator} ${value}
Input Text ${locator} ${value}
Set Log Level INFO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With