1

I wish to put the text from command prompt into a text file once the test is run. How do we do that ?Command Prompt

Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317

1 Answers1

3

Just use a pipe >. Worth to look Using command redirection operators.

ruby test.rb > file.txt

Redirection operator and description

> : Writes the command output to a file or a device, such as a printer, instead of the Command Prompt window.

< : Reads the command input from a file, instead of reading input from the keyboard.

>> : Appends the command output to the end of a file without deleting the information that is already in the file.

>& : Writes the output from one handle to the input of another handle.

<& : Reads the input from one handle and writes it to the output of another handle.

| : Reads the output from one command and writes it to the input of another command. Also known as a pipe.

Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
  • Great, also is there a way I can parameterize the inputs to script? Right now, I am sending keys like: - `browser.find_element(:xpath,"/html/body/div/input").send_keys"7.5",:tab` I wish if there could be a way where this input could be picked up from an external file? – SoftwareTestingEnthusiast May 02 '14 at 20:33
  • @user007 Check this out - [1](http://stackoverflow.com/questions/4244611/pass-variables-to-ruby-script-via-command-line) and [2](http://ruby.about.com/od/rubyfeatures/a/argv.htm) – Arup Rakshit May 02 '14 at 20:34