Forum Discussion
TanyaYatskovska
Alumni
13 years agoHi Tayssir,
As you want to get the object by its HTML tag, I would suggest that you use the EvaluateXPath method.
In this case, the script will look like this:
function Test()
{
...
var page = Sys.Browser("*").Page("*");
var tmp = page.EvaluateXPath("//TABLE[@id='AC67655C-39ED-4db9-9A69-A76F7AD3F3FA']");
if (tmp != null)
{
// If the element was found,
// convert the array to the JScript-compatible format
var arr = (new VBArray(tmp)).toArray();
// and simulate a click
arr[0].Click(); // Note we refer to the array item
}
else
{
// If the element was not found, post a message to the log
Log.Error("The element was not found.");
}
}