This is a migrated thread and some comments may be shown as answers.

FileUpload Dialog Problem

2 Answers 139 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aaaaa
Top achievements
Rank 1
Aaaaa asked on 08 Aug 2013, 12:47 PM
Hello,

I am trying to record steps for file upload functionality but it always fails so I need some help on that. My questions are the following:

1. I am trying to record the steps of uploading a file, so I have two steps added:
1.1. RadAsyncUpload and
1.2. Handle 'FileUpload' dialog
The first one gave me the following error: "Timed out waiting '60000' msec. for any dialog to be handled '1'"
For, example in http://www.telerik.com where I can change my avatar image, how can I test this functionality? I mean, there are custom names such as "Select" button. Can you provide me a code for coded step about testing this functionality or guide me through the process of recording steps?

2. If I want to run the test on another PC, where should I store the image (the file that will be uploaded) and what path should I use? Can you please give me an example?

2 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 08 Aug 2013, 04:23 PM
@ Point #1
I attached a test that, after logging into Telerik, will change your avatar for you. I recorded the steps and made no changes. This kind of test is easy because TS can handle all the dialogues for upload. You'll need to change the PATH inside of the upload dialogue name to upload your own avatar to make this work.

Uploading to a site like Imgur.com, however, is a bit harder. TS doesn't automatically find the dialogue box. There are two ways around this. You can try and setup a generic dialogue box through the UI, but this is often an effort in frustration. TS didn't find it using recording for a reason.

If we look at an upload dialogue, you can take note of two things.

1) Where is the cursor / focus? - In the case of imgur, the cursor is in the "File Name" field.
2) What is the name of the button to initiate the file upload? - In the case of imgur, it's "open".

That means that we can tell TS to type some simple keyboard commands to work with the file upload.

First... let's type the path of our image (bolded for emphasis):
Manager.Desktop.KeyBoard.TypeText("C:\construct.gif")


Next... let's press "ALT-O" to activate the OPEN button. The % sign serves as the ALT key (bolded for emphasis).
Manager.Desktop.KeyBoard.SendString("%o")

Success! We have handled the file dialogue with very little coded steps added.

I've attached this test as well.

@ Point #2
I've been storing images / files for upload on a shared directory on the network and putting the direct path to it.
ex: "\\ComputerName\SharedFolderName\FileName.img"

You could always map a network location on all of these computers if they're on different domains or you want to access the file from an FTP client. Just make sure the drive letter's the same. Here's a guide on how to map network drives.
http://www.sevenforums.com/tutorials/49517-map-network-drive.html?filter[2]=Networking%20Internet
0
Cody
Telerik team
answered on 12 Aug 2013, 10:43 PM
Hi,

On your first problem, can you share a screen shot what your upload dialog looks like? If it's a custom dialog (instead of the browsers built-in dialog) we'll need to find a custom way to handle it, such as what Robert has suggested. This would explain the timeout. We only recognize the standard browser dialog's, not custom dialog's.

For the second item, you can choose any path that works for you, but do remember it needs to be an absolute path. If you choose c:\testfiles\myfile.jpg that file needs to exist on all test PC's at the same location. Robert's idea of using a network path is another good idea.

@Robert, thanks for jumping in to assist. I've granted you some Telerik Points as a token of gratitude.

Regards,
Cody
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Aaaaa
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Cody
Telerik team
Share this question
or