Seemingly Stuck in a Winforms GridView
Posted: Wed Dec 10, 2014 10:29 pm
I've been trying to figure this out for two days now and, rather than completely drive myself crazy (although there are some, I'm sure, who would argue that I've been in that state for years), I thought I'd post my issue here and hope that someone can figure out what I'm missing.
I am working with an ordinary Winforms GridView which looks like this: When the value in the Outcome column is "Inconclusive", I want to click on the Notes button which is at the rightmost of each row. The problem that I'm having is that no matter where the Outcome is "Inconclusive" the Notes button clicked is always that on the first row; I need to click on the button corresponding to the row where "Inconclusive" is found.
Here is my code which works fine at iterating and finding the "Inconclusives" but does not select the correct Notes button; I, also, edited my repository item (included below) so that it will be row inspecific; in fact, when I edit it in Spy, it highlights both Note button objects but, from the repository it only highlights the first one...
My code:
Here is my repository item's Rx Path:
.//table[@controltypename='TestStepsDataGridView']//cell[@accessiblevalue='System.Drawing.Bitmap']
If anyone can help point out the error of my ways, I will greatly appreciate it.
Thanks,
Mike
I am working with an ordinary Winforms GridView which looks like this: When the value in the Outcome column is "Inconclusive", I want to click on the Notes button which is at the rightmost of each row. The problem that I'm having is that no matter where the Outcome is "Inconclusive" the Notes button clicked is always that on the first row; I need to click on the button corresponding to the row where "Inconclusive" is found.
Here is my code which works fine at iterating and finding the "Inconclusives" but does not select the correct Notes button; I, also, edited my repository item (included below) so that it will be row inspecific; in fact, when I edit it in Spy, it highlights both Note button objects but, from the repository it only highlights the first one...
My code:
Code: Select all
string strHeaderName = "Outcome";
IList<Ranorex.Cell> myCellList = t.Find<Ranorex.Cell>(".//cell[@accessiblename~'" + strHeaderName + "']");
foreach(Cell cell in myCellList )
{
if(!cell.IsHeader && cell.Text == "Inconclusive" || cell.Text == "Failed")
{
repo.TFSTestRun.TestRunPage.NoteButton.Click();
repo.Notes.NoteText.PressKeys(notesComment);
repo.Notes.Save.Click();
WinForms.SendKeys.SendWait("{Tab}");
}
}
.//table[@controltypename='TestStepsDataGridView']//cell[@accessiblevalue='System.Drawing.Bitmap']
If anyone can help point out the error of my ways, I will greatly appreciate it.
Thanks,
Mike