Verify CheckBox.isChecked property for the second time

3 posts, 1 answers
  1. Nagaraj
    Nagaraj avatar
    4 posts
    Member since:
    Mar 2013

    Posted 28 Jun 2013 Link to this post


    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 =
    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;
            d = f1.Find.ByTextContent("Item");
        catch (Exception ce)
            if (ce.Message.Contains("Element Not found"))
        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++)


    I am blocked because of this issue.

    Thanks in advance,
    Nagaraj R.
  2. Answer
    Dimitrina avatar
    3769 posts

    Posted 03 Jul 2013 Link to this post

    Hi Nagaraj,

    I would recommend you to work with the data item bound for the GridViewRow and its property corresponding to the IsChecked state.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Nagaraj
    Nagaraj avatar
    4 posts
    Member since:
    Mar 2013

    Posted 04 Jul 2013 Link to this post

    Thanks for the reply. 

    Thats working fine. Thanks a lot

    Nagaraj R.
Back to Top