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

radupload

3 Answers 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 12 Mar 2013, 02:03 PM
do you have any code samples for coding against radupload in code behind file of test?

3 Answers, 1 is accepted

Sort by
0
Byron
Telerik team
answered on 15 Mar 2013, 03:52 PM
Hello Pete,

We do not have code samples specific to the RadUpload control. However, recording against a RadUpload control results in a RadControl translator step for the file select button, customized in code as this:

// RadUpload('ctl00_ContentPlaceHolder1_RadUpload1'): input file 0 select
Pages.ASPNETUploadExamples.ContentPlaceHolder1RadUpload1Div.FileSelect(0);

and a standard Test Studio FileUpload dialog handler for the upload step. Please let us know if you have a specific testing scenario we can assist with. 

All the best,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Myo
Top achievements
Rank 1
answered on 16 Oct 2013, 05:19 AM
Hello Byron,

I tried code step from the link  Handling FileUpload Dialogs but not able to compile. Directive or Assembly references are missing for Find.Elements["uploadfile"].GetRectangle() and new Point(-10, 0) suppose to get zero argument but it has two arguments which make compilation errors..

Can we automate as data driven for radupload dialog file selection?


Thanks in advance,
Myo
0
Velin Koychev
Telerik team
answered on 21 Oct 2013, 08:31 AM
Hi Pete,

I am sorry to hear that  you are experiencing this issue.

You can also use the following complete code sample that you can test against a public website:
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);

You should be also able to automate radupload dialog file selection as data driven. If you are using the free Telerik Testing Framework and Visual Studio, you will need to follow their directions for creating a data driven test. If you are using Test Studio you need first to Bind the test to an external data source and then write the code in a coded step:

// You can reference the column by index
string fileLocation = (string)Data[0];
// Or by name
string fileLocation2 = (string)Data["Files"];

If you need additional assistance please do not hesitate to contact us and give us more details about your testing scenario.


Regards,
Velin Koychev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Pete
Top achievements
Rank 1
Answers by
Byron
Telerik team
Myo
Top achievements
Rank 1
Velin Koychev
Telerik team
Share this question
or