I have a Keyword as below which will be executed for every keyword.
Below is the code
*** Settings ***
Documentation Suite description
Test Template Templete key
Test Teardown Teardown key
*** Test Cases ***
Test case1
click element auto_id=1031 control_type=Button
*** Keywords ***
Templete key
[Arguments] @{args}
log ${Healing_Result}
run keyword if '${HR}'=='Error' or '${HR}'=='FAIL' fail
${status} ${ErrorMessage} run keyword if '${HR}'=='PASS' or '${status}'=='PASS' Run keyword and ignore error @{args}
... ELSE FAIL
run keyword if '${HR}'=='Error' fail
In log.html
Templete key right_click_element, title=${printer_Name}, control_type=ListItem
click element auto_id\=1031, control_type\=Button
I don't understand why are we seeing \
after auto_id
and control_type
When we run the below code separately,it works without problem . But when we run with template , I am facing this issue .
click element auto_id=1031 control_type=Button
This is because you have defined the keyword with variable arguments - @{args}
, while probably thinking of named arguments ("keyword arguments" in python).
Thus when you pass "auto_id=1031" to it, it's just a string that happens to have an equal sign in it, not "the parameter auto_id should have the value 1031"; and also because of that it escapes the = char.
To fix it, just go with named arguments:
Templete key
[Arguments] ${kw} &{args}
, and inside it:
Run keyword and ignore error ${kw} &{args}