0
votes

I'm using Robot Framework to run automated tests for my software. One test is to execute a script that will ask user to answer Yes or no to continue. I use the Run keyword to execute the test:

***Test Cases***
Run python myscript.py

myscript.py will start to install the software, but it stops to ask the user a few verification's. Is it possible for Robot Framework to write the "yes" or "No" answer to the executing process so that script will eventually finish?

1
How does the script ask the user? Does it pop up a dialog? Is it a command line prompt? - Bryan Oakley
Hi Bryan, it is a command line prompt. - markus veijola

1 Answers

2
votes

It would be simpler if you write a keyword which would install your required software in python and use it in robotframework.

Regarding sending 'yes' or 'no' am sure tf will be a command line thing in most of the cases. If it is use pexpect module in python to achieve it.

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)

This is just a sample script you can make your changes. But I would recommend you to handle it in python keyword rather than robot framework.

Hope it helps!