March 1, 2014

Browse and Upload the file in Cucumber & Capybara.


Browse and Upload the file in Cucumber & Capybara.

My Code in UI View:

<input type="file" name="multipartFile">


Browse Option:>

Then(/^I upload the file $/) do
  path = File.expand_path("a.txt")
  puts File.expand_path("a.txt")
  puts path
  attach_file('multipartFile', "C:\\Desktop\\a.txt")
end

Hope this script will be more useful.... Whenever you try to upload the files....


Use the below lines and upload the file. Use your scripting idea and share it......

No comments:

Post a Comment

WATIR

 WATIR - Web Application Testing Using Ruby. For Testing the Web applications; WATIR is the best open source tool for Automation. >> W...