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

FileUploadDialog is not working

5 Answers 94 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pavlo
Top achievements
Rank 1
Pavlo asked on 27 Feb 2012, 04:29 PM
Hi,

I use following code to handle HtmlInputFile Upload. But it is not working.
public void Upload(string filePath)
        {
            //((HtmlInputFile) TelerikHtmlWrapper).Upload(filePath, GlobalConst.FileUploadDialogTimeout);
            Manager manager = CoreManager.GetCurrentManagerObj();
 
            FileUploadDialog fDialog = new FileUploadDialog(TelerikHtmlWrapper.OwnerBrowser, filePath, DialogButton.OPEN);
 
            manager.DialogMonitor.Start();
            manager.DialogMonitor.AddDialog(fDialog);
 
            TelerikHtmlWrapper.Click();
            fDialog.WaitUntilHandled();
 
            manager.DialogMonitor.Stop();
        }

For IE9:
TelerikHtmlWrapper.Click()  Upload  dialog is shown but not processed and execution is hanging (Not even failing by timeout)
Issue is also reproducible if I use HtmlInputFile.Upload method instead of this code.

For FF9:
((HtmlInputFile)TelerikHtmlWrapper).Click() do not oped upload dialog. 
If I use HtmlInputFile.Upload method instead of this code Upload dialog is opened
but not processed, failing by timeout.




5 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 27 Feb 2012, 06:41 PM
Hello Pavlo,

The preceding click often needs to simulate a real click to launch the dialog properly. See the following code against a public site that works perfectly with all four browsers. Notice that each browser renders the HtmlInputFile differently, so I found a left double click to be the most reliable:

Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
ActiveBrowser.NavigateTo("http://encodable.com/uploaddemo/");
 
FileUploadDialog x = new FileUploadDialog(ActiveBrowser, @"C:\test.txt", DialogButton.OPEN);
Manager.DialogMonitor.Start();
Manager.DialogMonitor.AddDialog(x);
 
HtmlInputFile choose = Find.ById<HtmlInputFile>("uploadname1");
choose.MouseClick(MouseClickType.LeftDoubleClick);
 
x.WaitUntilHandled(10000);
ActiveBrowser.RefreshDomTree();
 
HtmlInputButton button = Find.ById<HtmlInputButton>("uploadbutton");
button.Click();
 
System.Threading.Thread.Sleep(3000);
 
Manager.DialogMonitor.Stop();
Manager.DialogMonitor.RemoveDialog(x);


Regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Pavlo
Top achievements
Rank 1
answered on 28 Feb 2012, 11:39 AM
Hi Anthony,

Thank you for your answer, but I still have the same issue:  Upload dialog is not processed, scenario is failing at WaitUntilHandled with timeout error.

I have to mention that HtmlInputFile is in the IFrame (RadWindow)

Best regards,
Pavlo Prystai
0
Anthony
Telerik team
answered on 28 Feb 2012, 07:26 PM
Hello Pavlo,

To continue troubleshooting I'll need the complete code that demonstrates the issue against a public site. The code I provided worked in version 2011.2.1413 using Windows XP, 7, Server 2008, and with IE 8 and 9.

As a work-around in the meantime you can use Blind Keyboard Typing and code to press the Enter key.

Kind regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Mykola
Top achievements
Rank 1
answered on 29 Feb 2012, 03:47 PM
Hi Anthony,
I try code snippet provided by your above and it's not working for me as well. Executing hang after File Upload appears.
Configuration which I use:
OS: Win 7 x32
Browser: IE8, FireFox 9
TTF: 2011.2.1305

Provided sample fails under IE and FF too. Also I'd like to mention that IE is configured by the follow recommendation.
Another thing which can probably be important is that we are sitting behind corporate proxy.
Also, I noticed that each time when File Upload Dialog is raised I had incoming connection (I saw it via KillWatcher tool), but income IP host address is quite strange. You can saw it on attached screenshot.
So maybe this can be as root cause of the upload issue ?

P.S.
We rollback from TTF version 2011.2.1413 to 2011.2.1305 since there are more stable execution, especially for FF (where need to add work around to be able launch FF instance).

Thanks,
Mykola.
0
Anthony
Telerik team
answered on 29 Feb 2012, 07:44 PM
Hello Mykola,

I retested the same code sample using Test Studio 2011.2.1305 and IE8. It worked as expected.

See my previous for what to provide to continue troubleshooting and a proposed work-around.

Regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Pavlo
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Pavlo
Top achievements
Rank 1
Mykola
Top achievements
Rank 1
Share this question
or