Knowledge Base Article

Get properties of a web page element


In this example, we will demonstrate how to get some more information about  a web element by using TestComplete.


How to find the “Start a topic” button on the community page page and get the following info about it: color, font family, and font size and post the script and the log info below.



function test2()
var url = "";

var page = Sys.Browser().Page(url);
var element = page.FindChildByXPath("//*[@class='NewTopic-link']");
var style = page.contentDocument.defaultView.getComputedStyle(element, "");
Log.Message("The Properties of web page element are as follows")
Log.Message("Background Color : " + style.backgroundColor);
Log.Message("Font Family : " + style.fontFamily);
Log.Message("Font Size : " + style.fontSize);


Published 3 years ago
Version 1.0

Was this article helpful?

No CommentsBe the first to comment