Forum Discussion
TanyaYatskovska
Alumni
11 years agoHi Chandresh,
It's better to use the FindChildByXPath method to find the object based on its HTML parameters. Here is an example:
//JScript
// ...
var page = Sys.Browser("*").Page("*");
var obj = page.FindChildByXPath("//LI[@id='SaveChanges']", false);
// Check the result
if (obj != null)
{
// If the element was found, click it
obj.Click();
}
else
{
// If the element was not found, post a message to the log
Log.Error("The element was not found.");
}
It's better to use the FindChildByXPath method to find the object based on its HTML parameters. Here is an example:
//JScript
// ...
var page = Sys.Browser("*").Page("*");
var obj = page.FindChildByXPath("//LI[@id='SaveChanges']", false);
// Check the result
if (obj != null)
{
// If the element was found, click it
obj.Click();
}
else
{
// If the element was not found, post a message to the log
Log.Error("The element was not found.");
}