[英]Is there a way to access the name of the YAML variable file passed as an argument to robot framework?
[英]How to access variables from .yaml file to robot framework script?
我有 Myvariable.yaml 文件和 sample.robot 文件,我想使用 .yaml 文件中的变量到机器人文件
Myvariable.yaml 文件:
ACFC NEWS: Doc_Title: XPath=//div[@class='ng-scope'] Open_Selector: xpath=//button[@class='btn btn-default ng-binding]
Sample.robot 文件
***Settings**** Variables Myvariable.yaml ***Keywords**** Choose Topic: Input Text ${Doc_Title} "Some text" Click Button ${Open_Selector}
错误:未找到变量
如果有人能帮助我解决这个问题,那就太好了。
您需要在此处访问 yaml 文件的属性,例如${DICT.one}
更多信息
你修改过的代码
*** Settings ***
Variables Myvariable.yaml
*** Test Case ***
Test
Choose Topic
***Keywords****
Choose Topic
Log ${ACFC NEWS.Doc_Title}
Log ${ACFC NEWS.Open_Selector}
我假设您正在使用以下命令运行脚本
pybot -V myvariable.yaml sample.robot
这现在应该可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.