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

Way to check if HtmlInputFile is empty while "uploading"

2 Answers 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Silvio
Top achievements
Rank 1
Silvio asked on 20 Dec 2012, 08:46 AM
Hi,

Sometimes when I set the value of a HtmlInputFile the value isn't set and after the set timeout a TimeoutException is thrown. In order to give the upload enough ime I have to set the timeout to 2 minues, so the TimeoutException is thrown after 2 minutes even if the value wasn´t set.
Is there any way to check if the value was set before the timeout is over? Two minutes are a long time for a not working test.

That´s my current code:
while (string.IsNullOrEmpty(uploadField.Value)
{
try
{
uploadField.Upload(path, 120000);
}
catch (TimeoutException) { Thread.Sleep(1000); }
}


Thanks
Kind regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Stoich
Telerik team
answered on 25 Dec 2012, 05:28 PM
Hello Silvio,
I'm not sure what you mean here:
even if the value wasn´t set.

How is it that the value is not set? Please elaborate on this so that I may assist (possible with a custom coded solution). Also, I was surprised to see that you seem to be using a different approach than the one outlined in this article:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/advanced-topics/handling-html-popups-and-dialogs/built-in-dialog-handlers/handling-fileupload-dialog.aspx

All the best,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 02 Jan 2013, 09:09 AM
Hi,

Sorry for the late reply, i´ve been ill.

"Even if the value wasn´t set" means, that the test is timed out the whole time even if it completely doesn´t work.

But the solution from documentation seems to work. I didn´t find it before.. Thanks for your help!

Kind regards
Tags
General Discussions
Asked by
Silvio
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Silvio
Top achievements
Rank 1
Share this question
or