CODEDUI: How to search for Hyperlink having same innertext values

Posted by Anu_Dgr8 under Visual Studio on 2/26/2013 | Points: 10 | Views : 2308 | Status : [Member] | Replies : 0
I am having menu Navigation feature for the following menus:
Create Request->Customers->Customer->Create
Create Request->Vendors->Create


I have used the following code to search for Hyperlink with the Innertext value (as provided from the input file).
 if (HCL.ControlType.ToString().ToLower() == "hyperlink")
{
HtmlHyperlink menuControl = this.UIMap.CurrentBrowserWindow.CurrentHtmlDocument.CurrentHyperlink;
menuControl.WindowTitles.Add(winTitle);
menuControl.SearchProperties["InnerText"] = strEachItem.ToString();

if (menuControl.Exists )
{


if (menuControl.BoundingRectangle.Width > 1)
{
Mouse.Click(menuControl);
}
else
{
UITestControlCollection objControl = menuControl.FindMatchingControls();
foreach (UITestControl control in objControl)
{
menuControl = (HtmlHyperlink)control;
if (menuControl.InnerText.ToLower() == strEachItem.ToLower())
{
if (menuControl.BoundingRectangle.Width > 1)
{
Mouse.Click(menuControl);
break;
}
}
}
}
}
this.UIMap.CurrentBrowserWindow.CurrentHtmlDocument.CurrentHyperlink = null;
}

But the problem here is 2 Hyperlinks are having the same innertext value.So for the navigation "Create Request->Vendors->Create
",its not searching the correct "Create" hyperlink.Instead its searching for "Create" hyperlink which is present in the following navigation:

"Create Request->Customers->Customer->Create"

Stuck in this issue from past 2 days.Urgently need help.

Thanks and Regards,
Hoosha Boosha



Responses

(No response found.)

Login to post response