See the following code:
Code: Select all
public static int DOMClickLink(Ranorex.WebElement webDocumentName, string LinkText)
{
ATag DOMlink;
//Search for the Link on the page
try
{
webDocumentName.EnsureVisible();
Thread.Sleep(500);
DOMlink=webDocumentName.FindSingle(".//a[@innertext='" + LinkText + "']");
}
catch (RanorexException e)
{
Report.Error("Unable to find Link: " + LinkText);
Report.Screenshot();
Console.WriteLine("Unable to find Link: " + LinkText);
return -1;
}
//Click a Link
try
{
Report.Info("Clicking Link: " + LinkText);
DOMlink.Focus();
// Thread.Sleep(500);
DOMlink.Click(Location.Center);
Report.Debug(" Clicked Link: " + LinkText);
}
catch (RanorexException e)
{
Report.Error(e.ToString());
Report.Screenshot();
Console.WriteLine(e.ToString());
return -1;
}
return 0;
} //End DOMClickLink
WebDocument webDocument="/dom[@domain='XXXXX']";
Automation.DOMClickLink(webElement ,"Name");
My problem is that It takes a lot of time to find my link element.
This is the RanorexPath for the link above:
/dom[@domain='XXXXX']//tr/td[4]/a[@innertext='XXXX']/../../td[7]/a[@innertext='XXXXX']
How can i increase my time to find my element ?
thanks in advance