How to access variables from .yaml file to robot framework script?
12,255
you need to access the attributes of yaml file like ${DICT.one}
more information here
your modified code
*** Settings ***
Variables Myvariable.yaml
*** Test Case ***
Test
Choose Topic
***Keywords****
Choose Topic
Log ${ACFC NEWS.Doc_Title}
Log ${ACFC NEWS.Open_Selector}
I am assuming you are running the script with below command
pybot -V myvariable.yaml sample.robot
This should solve your problem now.
Author by
Uday
Updated on July 15, 2022Comments
-
Uday almost 2 years
I have Myvariable.yaml file and sample.robot file, I wanted to use the variables from .yaml file to robot file
Myvariable.yaml file:
ACFC NEWS: Doc_Title: XPath=//div[@class='ng-scope'] Open_Selector: xpath=//button[@class='btn btn-default ng-binding]
Sample.robot file
***Settings**** Variables Myvariable.yaml ***Keywords**** Choose Topic: Input Text ${Doc_Title} "Some text" Click Button ${Open_Selector}
Error: Variable not found
It would be great if any one can help me in solving this issue.
-
pankaj mishra over 6 yearsyour code is not properly formatted, always paste code with proper formatting
-
Uday over 6 yearsExcellent the problem is solved now. Thank you o much for the help Pankaj