This is a migrated thread and some comments may be shown as answers.

Automating click on RadGridView row throws FindElementException

11 Answers 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
brian sullivan
Top achievements
Rank 1
brian sullivan asked on 09 Aug 2012, 11:04 PM
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?

11 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 13 Aug 2012, 07:06 PM
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
0
brian sullivan
Top achievements
Rank 1
answered on 13 Aug 2012, 07:11 PM
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?

0
Cody
Telerik team
answered on 13 Aug 2012, 07:22 PM
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
0
brian sullivan
Top achievements
Rank 1
answered on 13 Aug 2012, 07:38 PM
No problem. Please find my test project attached.
0
Cody
Telerik team
answered on 13 Aug 2012, 08:17 PM
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
0
brian sullivan
Top achievements
Rank 1
answered on 13 Aug 2012, 08:59 PM
Cody,

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

Brian
0
brian sullivan
Top achievements
Rank 1
answered on 13 Aug 2012, 09:26 PM
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
0
Cody
Telerik team
answered on 13 Aug 2012, 10:18 PM
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
0
brian sullivan
Top achievements
Rank 1
answered on 13 Aug 2012, 10:23 PM
11am tomorrow sounds fine. Thanks for all your help! Brian
0
Cody
Telerik team
answered on 14 Aug 2012, 06:48 PM
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
0
Cody
Telerik team
answered on 17 Aug 2012, 10:14 PM
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
Tags
General Discussions
Asked by
brian sullivan
Top achievements
Rank 1
Answers by
Cody
Telerik team
brian sullivan
Top achievements
Rank 1
Share this question
or