Way to check if HtmlInputFile is empty while "uploading"

3 posts, 1 answers
  1. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 20 Dec 2012 Link to this post

    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. Answer
    Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 25 Dec 2012 Link to this post

    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
  3. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 02 Jan 2013 Link to this post

    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
Back to Top