Highlighted
Ben_Langton Absent Member.
Absent Member.
2505 views

How to get the foreground color of text in Open Agent?

Jump to solution

[Migrated content. Thread originally posted on 14 April 2011]

How can I get the foreground color of text in Open Agent? It seems like ExecuteJavaScript() might be the only way to do it, but I can't figure out how to get it to work. Can someone please provide an example?

SilkTest Development: It would REALLY be helpful to have this, and many other attributes that one might actually want to verify, available via GetProperty(), or GetDomAttribute(). There seems to be a lot of useless attributes and properties available. I don't care what the onclick() event is, or what the class is; I care what the element actually looks like to a user.

Thanks in advance,

Ben Langton
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

RE: How to get the foreground color of text in Open Agent?

Jump to solution
Hi Ben,

You should be able to get the value of the foreground color using the GetProperty method.

For example:

Desktop.Find("//BrowserWindow//DIV[@textContents='Example Text']").GetProperty("currentStyle:color")


Let me know if this helps.

Robert
0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

RE: How to get the foreground color of text in Open Agent?

Jump to solution
Hi Ben,

You should be able to get the value of the foreground color using the GetProperty method.

For example:

Desktop.Find("//BrowserWindow//DIV[@textContents='Example Text']").GetProperty("currentStyle:color")


Let me know if this helps.

Robert
0 Likes
Ben_Langton Absent Member.
Absent Member.

RE: How to get the foreground color of text in Open Agent?

Jump to solution
Great! Thank you very much. (Sorry for the delay; I didn't get an email notification that someone had replied).

That did work. I had given up on that avenue because the example in the Help, .GetProperty("currentStyle:fontName") returns "The property 'currentStyle:fontName' is not supported.", and "currentStyle" is not returned by GetDomAttributeList().

Anyway, it works!

Thanks,

Ben Langton
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.