Guest User

Untitled

a guest
Jun 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. require 'selenium'
  2. require 'test/unit'
  3. require 'win32ole'
  4.  
  5. class DownloadFileTest < Test::Unit::TestCase
  6. def setup()
  7. @wsh = WIN32OLE.new('Wscript.Shell')
  8. end
  9. def teardown
  10. WIN32OLE.ole_free(@wsh) # yes, this is required *rolls eyes*
  11. end
  12. def test_download_file
  13. # ...stuff that causes a download window to pop up...
  14. @wsh.AppActivate("Opening")
  15. sleep(2)
  16. @wsh.SendKeys("{RIGHT}{ENTER}") # Hits ok button - file downloads
  17. sleep(3)
  18. # Use regular Ruby File methods to assert stuff on the file content
  19. end
Add Comment
Please, Sign In to add comment