Uday
Uday

Reputation: 131

How to access variables from .yaml file to robot framework script?

I have Myvariable.yaml file and sample.robot file, I wanted to use the variables from .yaml file to robot file

Error: Variable not found

It would be great if any one can help me in solving this issue.

Upvotes: 3

Views: 21205

Answers (1)

pankaj mishra
pankaj mishra

Reputation: 2615

you need to access the attributes of yaml file like ${DICT.one} more information here

https://github.com/robotframework/robotframework/blob/master/doc/userguide/src/CreatingTestData/ResourceAndVariableFiles.rst#variable-file-as-yaml

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.

Upvotes: 8

Related Questions