I get the following errors when I try to use the below code. I am trying to Upload a file where the file name is Data Driven and the file path from the project. I have the recorded step still, but disabled in the test. If I can use the "fullPath" variable in the recorded step, that would work for me also.
c:\Documents and Settings\gpittman\My Documents\WebUI Test Studio Projects\PLA\Helper\Submissions\Edit_Upload_Document.aii.cs: Line 95: (CS0246) The type or namespace name 'FileUploadDialog' could not be found (are you missing a using directive or an assembly reference?)
c:\Documents and Settings\gpittman\My Documents\WebUI Test Studio Projects\PLA\Helper\Submissions\Edit_Upload_Document.aii.cs: Line 95: (CS0246) The type or namespace name 'FileUploadDialog' could not be found (are you missing a using directive or an assembly reference?)
c:\Documents and Settings\gpittman\My Documents\WebUI Test Studio Projects\PLA\Helper\Submissions\Edit_Upload_Document.aii.cs: Line 95: (CS0103) The name 'DialogButton' does not exist in the current context
c:\Documents and Settings\gpittman\My Documents\WebUI Test Studio Projects\PLA\Helper\Submissions\Edit_Upload_Document.aii.cs: Line 95: (CS0246) The type or namespace name 'FileUploadDialog' could not be found (are you missing a using directive or an assembly reference?)
c:\Documents and Settings\gpittman\My Documents\WebUI Test Studio Projects\PLA\Helper\Submissions\Edit_Upload_Document.aii.cs: Line 95: (CS0246) The type or namespace name 'FileUploadDialog' could not be found (are you missing a using directive or an assembly reference?)
c:\Documents and Settings\gpittman\My Documents\WebUI Test Studio Projects\PLA\Helper\Submissions\Edit_Upload_Document.aii.cs: Line 95: (CS0103) The name 'DialogButton' does not exist in the current context
using
Telerik.WebAii.Controls.Html;
using
Telerik.WebAii.Controls.Xaml;
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.IO;
using
ArtOfTest.Common.UnitTesting;
using
ArtOfTest.WebAii.Core;
using
ArtOfTest.WebAii.Controls.HtmlControls;
using
ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using
ArtOfTest.WebAii.Design;
using
ArtOfTest.WebAii.Design.Execution;
using
ArtOfTest.WebAii.ObjectModel;
using
ArtOfTest.WebAii.Silverlight;
using
ArtOfTest.WebAii.Silverlight.UI;
namespace
PLA2
{
//
// You can add custom execution steps by simply
// adding a void function and decorating it with the [CodedStep]
// attribute to the test method.
// Those steps will automatically show up in the test steps on save.
//
// The BaseWebAiiTest exposes all key objects that you can use
// to access the current testcase context. [i.e. ActiveBrowser, Find ..etc]
//
// Data driven tests can use the Data[columnIndex] or Data["columnName"]
// to access data for a specific data iteration.
//
// Example:
//
// [CodedStep("MyCustom Step Description")]
// public void MyCustomStep()
// {
// // Custom code goes here
// ActiveBrowser.NavigateTo("http://www.google.com");
//
// // Or
// ActiveBrowser.NavigateTo(Data["url"]);
// }
//
public
class
Edit_Upload_Document : BaseWebAiiTest
{
#region [ Dynamic Pages Reference ]
private
Pages _pages;
/// <summary>
/// Gets the Pages object that has references
/// to all the elements, frames or regions
/// in this project.
/// </summary>
public
Pages Pages
{
get
{
if
(_pages ==
null
)
{
_pages =
new
Pages(Manager.Current);
}
return
_pages;
}
}
#endregion
public
static
string
Document {
get
;
set
;}
// Add your test methods here...
//[CodedStep(@"Submission_Document")]
//public void Edit_Upload_Document_CodedStep()
{
// string DocumentName = String.Concat("Submission_Documents\\", Data["SubmissionDocument"]);
// string fullPath = System.IO.Path.Combine(this.ExecutionContext.DeploymentDirectory, DocumentName);
// Log.WriteLine("fullPath: '" + fullPath + "'");
//}
[CodedStep(@
"File Upload"
)]
public
void
Edit_Upload_Document_FileUpload()
{
string
DocumentName = String.Concat(
"Submission_Documents\\", Data["
SubmissionDocument"]);
string
fullPath = System.IO.Path.Combine(
this
.ExecutionContext.DeploymentDirectory, DocumentName);
Log.WriteLine(
"fullPath: '"
+ fullPath +
"'"
);
FileUploadDialog fDialog =
new
FileUploadDialog(ActiveBrowser, fullPath, DialogButton.OPEN);
Manager.Current.DialogMonitor.AddDialog(fDialog);
Manager.Current.DialogMonitor.Start();
HtmlInputFile fUpload= ActiveBrowser.Find.ByName<HtmlInputFile>(
"inputfile"
);
fUpload.Click();
fDialog.WaitUntilHandled();
Manager.Current.DialogMonitor.Stop();
}
}
}