Forum Discussion
TanyaYatskovska
Alumni
13 years agoHi Josette,
The Click method is some kind of a universal method. So, it should work for SPAN. It worked for my case:
HTML:
<script>
function myFunction()
{alert ("Some Text");}
</script>
<html>
...
<div>We are executing the <span id="textSpan" style="color:blue;font-weight:bold" onclick="myFunction()">Test</span>.</div>
</html>
This is the JScript code run from TestComplete:
function main()
{
var page = Sys.Browser("iexplore").Page(*);
var obj = page.FindChildByXPath("//span[@id='textSpan']", false);
if (obj != null)
{
obj.Click();
}
else
{
Log.Error("The element was not found.");
}
}