-2

While trying to run script for image upload or file upload, I get following play back error in SAHI open source.

What could be done to prevent this error?

Script goes like:

_click(_link("プロフィール"));
_assertExists(_file("profile-fileupload"));
_assert(_isVisible(_file("profile-fileupload")));
_assertEqual("", _getValue(_file("profile-fileupload")));
_setFile2(_file("profile-fileupload"), "C:\\fakepath\\IMG_69546123046766.jpeg");
Unheilig
  • 16,196
  • 193
  • 68
  • 98
Aneal
  • 3
  • 3

1 Answers1

0

You can't record a file upload. Sahi just provided a dummy path for file upload. If you look at this:

_setFile2(_file("profile-fileupload"), "C:\\fakepath\\IMG_69546123046766.jpeg");

This is using fakepath. Enter the actual filesystem path of your file and it will be uploaded.

Vivek V Dwivedi
  • 2,510
  • 2
  • 28
  • 39
  • Script in playback runs successfully, but the image in path is not uploaded after I modified another file image path in script. Is there anything wrong? – Aneal Jul 01 '15 at 04:41
  • I used the native event for upload setFileUpload(_file("id"), "C:\\abc\\efg.jpg"); This worked well in sahi pro trial version, but I recorded the script in sahi OS , it gave error like: ReferenceError: "_focusWindow" is not defined, and playback stopped. – Aneal Jul 02 '15 at 12:01