0

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?

2
  • How does the script ask the user? Does it pop up a dialog? Is it a command line prompt? Commented Jan 11, 2017 at 17:38
  • Hi Bryan, it is a command line prompt. Commented Jan 12, 2017 at 17:54

1 Answer 1

2

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.