Automating click on RadGridView row throws FindElementException

12 posts, 0 answers
  1. brian sullivan
    brian sullivan avatar
    5 posts
    Member since:
    Nov 2007

    Posted 09 Aug 2012 Link to this post

    I'm trying to automate a click on a RadGridView row to get it to enter edit mode. My UI is brain-dead simple, as I'm just evaluating the test Framework for use in our real application. It's just a RadViewGrid in a Window. I'm using MS Test to run the UI tests. I'm just binding the RadGridView to a collection of dummy objects. The test looks like this:

    public void CanObserveCellContent()
    {
        var grid = wpfApp.MainWindow.Find.ByName<RadGridView>("_searchResults");
        grid.Rows[0].User.Click(MouseClickType.LeftDoubleClick);
        //other steps and assertions
    }

    The second line simulating the click throws the exception. But if I change the second line to this and comment out the rest of the test:

    Assert.AreEqual("Test1", grid.Rows[0].Cells[0].Text);

    the test passes. What is it about clicking automation that makes it unable to find the row?
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 13 Aug 2012 Link to this post

    Hello Brian,

    You really need to pick a specific cell to click on:

    RadGridView grid = ActiveApplication.MainWindow.Find.ByName<RadGridView>("RadGridView1");
    grid.Rows[1].Cells[2].User.Click(MouseClickType.LeftDoubleClick);

    All the best,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. brian sullivan
    brian sullivan avatar
    5 posts
    Member since:
    Nov 2007

    Posted 13 Aug 2012 Link to this post

    Cody,

    Thanks for the reply, but the same exception is thrown when I change the code to perform the click on a cell instead of the row. I get the following exception:

    ArtOfTest.Common.Exceptions.FindElementException: Unable to find the specified element: Unable to find the element of type: gridviewcell

    Any other ideas? Do you need more of my code to look into this?

  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 13 Aug 2012 Link to this post

    Hi,

    What I really need is a copy of your WPF application (source code or .exe) so i can reproduce this problem. I am not able to reproduce it using our WPF samples which include a RadGridView.

    Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  5. brian sullivan
    brian sullivan avatar
    5 posts
    Member since:
    Nov 2007

    Posted 13 Aug 2012 Link to this post

    No problem. Please find my test project attached.
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 13 Aug 2012 Link to this post

    Hi Brian,

    Thank you for the project. I was able to reproduce the problem with it. I don't know what's going on exactly, possibly a bug in our WPF RadGridView translator. I found I can overcome it by manually fetching a list of all the GridViewRow's like this:

    RadGridView grid = ActiveApplication.MainWindow.Find.ByName<RadGridView>("_searchResults");
    IList<GridViewRow> rows = grid.Find.AllByType<GridViewRow>();
    rows[0].Cells[2].User.Click(MouseClickType.LeftDoubleClick);

    I'm going to file an internal bug to try and get to the bottom of why grid.Rows[0] doesn't work as expected with your simple application. Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  7. brian sullivan
    brian sullivan avatar
    5 posts
    Member since:
    Nov 2007

    Posted 13 Aug 2012 Link to this post

    Cody,

    Thanks! Good to know that I'm not crazy. I'll move forward with the workaround you provided. Thank you!

    Brian
  8. brian sullivan
    brian sullivan avatar
    5 posts
    Member since:
    Nov 2007

    Posted 13 Aug 2012 Link to this post

    Looks like I spoke too soon. I replied before trying your workaround. I'm still getting that same exception when I try to perform the click. I created another test method with only the code you posted, and I still get the FindElementException. Any clue why I'd get the exception and you wouldn't?

    Brian
  9. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 13 Aug 2012 Link to this post

    Hello,

    The version of the WPF controls is my only thought. I was prompted to upgrade the project when I loaded your project - see the attached screen shot.

    I'd like to look at this problem on your computer via GoToMeeting. Would tomorrow at 11am Central Time work for you?

    1.  Please join my meeting, Tuesday, August 14, 2012 at 11:00 AM Central Daylight Time.
    https://www2.gotomeeting.com/join/139616130

    2.  Use your microphone and speakers (VoIP) - a headset is recommended.  Or, call in using your telephone.

    Dial +1 (312) 878-3082
    Access Code: 139-616-130
    Audio PIN: Shown after joining the meeting

    Meeting ID: 139-616-130

    GoToMeeting®
    Online Meetings Made Easy™


    All the best,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  10. brian sullivan
    brian sullivan avatar
    5 posts
    Member since:
    Nov 2007

    Posted 13 Aug 2012 Link to this post

    11am tomorrow sounds fine. Thanks for all your help! Brian
  11. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 14 Aug 2012 Link to this post

    Hello,

    Just a quick follow up to document the outcome of our meeting.... I can't explain why you're getting the exception. You will work on upgrading the version of the Telerik WPF controls installed on your machine to at least .725 version to match what I'm using since I don't get the error on my machine using the same code.

    Greetings,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  12. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 17 Aug 2012 Link to this post

    Hello,

    Just following up, do you still need assistance with this problem?

    Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top