简体   繁体   English

python脚本调用API如何在robotremoteserver库中定义?

[英]How can python script call API define in robotremoteserver library?

my robotremoteserver library defines some API like startenv, stopenv我的机器人远程服务器库定义了一些 API,如 startenv、stopenv

from robotremoteserver import RobotRemoteServer

class myLibrary(object):
    def startenv(self):
        return "start"
    def stopenv(self):
        return "stop"

if __name__ == '__main__':
    RobotRemoteServer(myLibrary(), *sys.argv[1:])

I tried a c.txt as robot file and was able to call API,我尝试了一个 c.txt 作为机器人文件并且能够调用 API,

** Settings ***
Library       Remote    http://serverxxxx:8720
*** Test Cases ***
startenv
    ${rc} =    startenv
stopenv
    ${rc} =    stopenv

but How can we call these from remote XMLRPC python client script?但是我们如何从远程 XMLRPC python 客户端脚本调用这些? tried things as below尝试如下

from robot.libraries.Remote import Remote
s = Remote('http://serverxxxx:8270')
s.startenv()
s.run_keyword("startenv")

But none works :(但没有一个工作:(

It should be s.run_keyword("startenv",None,None).它应该是 s.run_keyword("startenv",None,None)。 run_keyword() takes 4 positional arguments run_keyword() 需要 4 个位置参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Robot Framework中使用获取库实例调用Python库函数 - How to call Python Library Function using Get Library Instance in Robot Framework 如何安装python数据库库以与robotframework配合使用-API问题 - How to install python database library to work with robotframework - API issue 从 Python 脚本调用机器人关键字 - Call Robot Keyword from Python script 如何在RobotFramework中将基本身份验证传递给API调用 - How to pass basic authentication to API call in robotframework Robot Framework如何使用变量库名称调用关键字 - Robot Framework how to call keyword with variable library name 如何让我的gradle测试任务对不在maven central上的库使用python pip install? - How can I get my gradle test task to use python pip install for library that isn't on maven central? 如何编写测试脚本以调用RobotFramework中的存储过程 - How to write test script to call stored procedure in robotframework 如何在Robot框架中调用python模块 - How to call python module in Robot framework 如何在Robot Framework中同时调用基于Java和Python的库? - How can I call both Java- and Python-based libraries in Robot Framework? 我如何从Python脚本导入机器人关键字文件并从该文件执行关键字并生成报告 - How can i import Robot Keywords file from Python script and execute keywords from that file and generate report
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM