Hi,
Below is the operation which i am trying to automate
1. Get all the content of the grid and searching for a particular text.
a. If the grid contains the text, then i need to Check a corresponding CheckBox of the GridViewRow
b. Else if the grid does not contains the text, then i need to scroll the page down and repeat the opeation till i find the text
2. Once i clicked on the text when i am trying to verify if the CheckBox is Checked or not, i am getting the below exception
"IsChecked = '((ArtOfTest.WebAii.Silverlight.UI.ToggleButton)(_uiElement)).IsChecked' threw an exception of type 'ArtOfTest.WebAii.Silverlight.ExecuteSilverlightCommandException'"
Below mentioned the code which i have used. Let me know how it can be rectified.
FrameworkElement f =
null
;
FrameworkElement f1 =
null
;
ScrollBar sc = Browser.BrowserApplication.Find.ByName<ScrollBar>(
"PART_VerticalScrollBar"
);
ISLRepeatButton rp = sc.Find.ByName<SLRepeatButton>(
"VerticalLargeIncrease"
);
ISLRepeatButton si = sc.Find.ByName<SLRepeatButton>(
"VerticalSmallIncrease"
);
f = Browser.BrowserApplication.Find.ByName<Grid>(
"PART_RootPanel"
);
f1 = f.Find.ByType<ScrollContentPresenter>();
for
(
int
i = 0; i < 1000; i++)
{
ISLCheckBox c =
null
;
FrameworkElement d =
null
;
try
{
d = f1.Find.ByTextContent(
"Item"
);
}
catch
(Exception ce)
{
if
(ce.Message.Contains(
"Element Not found"
))
{
rp.CustomClick(
true
);
f.Refresh();
continue
;
}
}
c = d.Parent<XAML.GridViewCell>().Parent<XAML.GridViewRow>().Find.ByName(
"PART_DataCellsPresenter"
).Find.ByType<CheckBox>();
if (c.isChecked != true) // but while verifying for the first time i m getting error
{
c.Click(); // once the CheckBox property is changed, i am unable to retrieve the value of isChecked again
if
(c.isChecked !=
true
) // getting exception in this line
{
for
(
int
j = 0; j <= 4; j++)
{
si.CustomClick(
true
);
}
c.Click();
}
}
break
;
}
I am blocked because of this issue.
Thanks in advance,
Nagaraj R.