Python Robot框架执行请求用户验证的脚本
我正在使用Robot框架为我的软件运行自动化测试。一个测试是执行一个脚本,要求用户回答“是”或“否”以继续。我使用Python Robot框架执行请求用户验证的脚本,python,robotframework,Python,Robotframework,我正在使用Robot框架为我的软件运行自动化测试。一个测试是执行一个脚本,要求用户回答“是”或“否”以继续。我使用Run关键字执行测试: ***Test Cases*** Run python myscript.py myscript.py将开始安装该软件,但它会停下来询问用户一些验证。Robot Framework是否可以为执行过程编写“是”或“否”的答案,以便脚本最终完成?如果您编写一个关键字,用python安装所需的软件并在robotframework中使用它,则会更简单 关于发送“是”
Run
关键字执行测试:
***Test Cases***
Run python myscript.py
myscript.py将开始安装该软件,但它会停下来询问用户一些验证。Robot Framework是否可以为执行过程编写“是”或“否”的答案,以便脚本最终完成?如果您编写一个关键字,用python安装所需的软件并在robotframework中使用它,则会更简单 关于发送“是”或“否”,我确信在大多数情况下,tf将是一个命令行。如果需要,请使用python中的pexpect模块来实现它
import pexpect
child = pexpect.spawn("<your installation command>")
child.timeout = <desired timeout value>
child.expect("<a string that would indicate script to send yes or no") ## most of the software's has "do you want to continue?" where you say yes or no##
child.sendline('Yes')
child.expect(pexpect.EOF)
import-pexpect
child=pexpect.spawn(“”)
child.timeout=
expect(“如果您编写一个关键字,用python安装所需的软件,并在robotframework中使用它,则会更简单
关于发送“是”或“否”,我确信在大多数情况下,tf将是一个命令行工具。如果需要,请使用python中的pexpect模块来实现它
import pexpect
child = pexpect.spawn("<your installation command>")
child.timeout = <desired timeout value>
child.expect("<a string that would indicate script to send yes or no") ## most of the software's has "do you want to continue?" where you say yes or no##
child.sendline('Yes')
child.expect(pexpect.EOF)
import-pexpect
child=pexpect.spawn(“”)
child.timeout=
child.expect(“脚本如何询问用户?是否弹出对话框?是否为命令行提示符?嗨,Bryan,这是命令行提示符。脚本如何询问用户?是否弹出对话框?是否为命令行提示符?嗨,Bryan,这是命令行提示符。