or
[CodedStep(@
"Keyboard (KeyPress) - Tab (1 times) on 'NewCensusEffectiveDateTextBox'"
)]
public
void
NavToPatient_CodedStep()
{
ActiveBrowser.ContentWindow.SetFocus();
Pages.AdminCensus.NewCensusEffectiveDateTextBox.ScrollToVisible();
Pages.AdminCensus.NewCensusEffectiveDateTextBox.Focus();
ActiveBrowser.Manager.Desktop.KeyBoard.KeyPress(ArtOfTest.WebAii.Win32.KeyBoard.KeysFromString(
"Tab"
), 100, 1);
ActiveBrowser.WaitUntilReady();
}
<
input
type
=
text
size
=
10
maxlength
=
10
name
=
effective_date
value
=
"1/1/2001"
onkeypress
=
"return filterKeys(event)"
onfocus
=
'setDateItem(this, "P")'
onblur
=
"reformatDate(this)"
onchange
=
'reformatDate(this); javascript:ESOLValidateDateString(frmData.effective_date);checkUpdateCareLevel();'
>
=
'reformatDate(this);
" to run.public
override
void
OnBeforeTestStarted()
{
Manager.DialogMonitor.AddDialog(
new
AlertDialog(ActiveBrowser, DialogButton.OK));
Manager.DialogMonitor.Start();
}
public
override
void
OnBeforeTestStarted()
{
AlertDialog myAlertDialog =
new
AlertDialog(ActiveBrowser, DialogButton.OK);
myAlertDialog.HandlerDelegate =
new
DialogHandlerDelegate(MyCustomAlertHandler);
//Manager.DialogMonitor.AddDialog(new AlertDialog(ActiveBrowser, DialogButton.OK));
Manager.DialogMonitor.AddDialog(myAlertDialog);
Manager.DialogMonitor.Start();
}
public
void
MyCustomAlertHandler(IDialog dialog)
{
// Simply close the dialog
System.Threading.Thread.Sleep(1500);
System.Drawing.Bitmap image = Manager.ActiveBrowser.Capture();
//System.Drawing.Bitmap image = Manager.ActiveBrowser.Window.GetBitmap();
image.Save(
this
.ExecutionContext.DeploymentDirectory.ToString() + @
"\Data\alert.png"
, System.Drawing.Imaging.ImageFormat.Png);
dialog.Window.Close();
try
{
// Wait until it is closed
dialog.Window.WaitForVisibility(
false
, 50);
Log.WriteLine(
"Alert Handled!"
);
}
catch
{
Log.WriteLine(
"Failed to handle alert!"
);
}
}
public
static
class
PCCSR
{
public
static
string
root = ExecutionContext.Current.DeploymentDirectory + @
"\Data\"
;
public
static
void
NSRtestWPF()
{
Manager.Current.LaunchNewApplication(root + @
"PCCNSR.exe"
,
"Admin"
);
ListBox b = Manager.Current.ActiveApplication.MainWindow.Find.ByName<ListBox>(
"lstbxFiles"
);
Assert.IsTrue(b.Items.Contains(
"Baseline_Security_Roles_Admin.csv"
),
"File not found"
);
}
}