Forum Discussion
TanyaYatskovska
10 years agoSmartBear Alumni (Retired)
Hi 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.");
}
Related Content
Recent Discussions
- 2 days agoAndiiiA
- 3 days agomegha_phophalia
Log functions
Solved3 days agoAurore