Question & Answer
Question
How can you retrieve HTML text with the InnerText Property in IBM Rational Robot? This documents contains an example with an HTML table.
Cause
You cannot put the text of an HTML page, or part of it, into an SQABasic script variable. It is possible with the property "InnerText". This property is available for all HTML objects.
Answer
How you can get the InnerText value?
- Record a click action or perform a verification point on the HTML object that you are interested in, in order to get its recognition string.
- Once Robot established the recognition string, use it as the first argument to the SQAGetProperty() function. The second argument is "InnerText".
Here is an example of a script:
Sub Main Dim Value As Variant Window SetContext, "Caption=test - Microsoft Internet Explorer","" Browser NewPage,"","" ' store object property with InnerText argument into variable SQAGetProperty "Type=HTMLTable;HTMLId=Names","InnerText",value SQAConsoleWrite "Value : " & value End Sub |
An example of an HTML page is :
<HEAD><TITLE>test</TITLE></HEAD> <BODY> <TABLE id=Names> <TR> <TD>Jones</TD></TR> <TR> <TD>Smith</TD></TR> <TR> <TD>Harry</TD></TR> </TABLE> </BODY> </HTML> |
Note: you can use the property "InnerHTML" also to retrieve both the HTML tags and the text. For example, as delimiters for easy string manipulation.
[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003.06.12;2003.06.13;2003.06.14;2003.06.15;7.0;7.0.0.1;7.0.0.2;7.0.0.4;7.0.1;7.0.1.1;7.0.1.2;7.0.1.3;7.0.1.4;7.0.1.5;7.0.2;7.0.2.1;7.0.2.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21173678