Highlighted
Absent Member.. Absent Member..
Absent Member..
1811 views

How to extract XML value that is displayed in webpage

Jump to solution

Hello Guys,

Our application is displaying an XML message in a web page. I need to perform a test by checking if the correct values are displayed in that XML message. My expected result is coming from MS ACCESS  and I need cross check it with my Actual result coming from that XML message displayed in page.

1st question: Is possible to directly use that XML message in that web page as my actual result?

2nd question: If not possible, I can see that the XML message can be seen in 'innertext'. How can I extract the XML message in 'innertext' and save it to local file as .xml file? and will then be used for validation.

3rd: What are the other ways to get the values in XML message displayed in web?

Notes:
-WebXML is not included as object property.
-innerhtml properyt doesn't hold the correct XML message.

Tags (2)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

You can get the innertext from the WebObject (not sure abt the object type) by using GetROProperty methoid and specifying the innertext property. GetROProperty("innerText")

xmlContent = Browser().Page().WebElement().GetROProperty("innerText")

Then load the string to create XML doc. Refer help for more details. Working with XML

_____________________
Rajkumar Rajangam

View solution in original post

5 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Hi ENDK_jsq

Hope you are doing well.

 

You may go to:

User Help > GUI Test Objects, Checkpoints and Output Values > Checkpoints in GUI Testing > Checkpoint Types > XML checkpoints 

 

Or also i found below documentation that may help:

Unified Functional Testing (UFT) version 11.5x and higher, have introduced a new background method, activity classes and objects for programmatic data source access.

Below find summarized information about topic. For more detailed information, see any of below sections on UFT User Guides > API Testing Design: "Coding UFT Events > Tasks > How to Manipulate Data During Run Time" or "Writing Event Handlers for API Test Steps > Tasks > How to Manipulate Data Programatically"

Related topics: Document ID KM00763094 - UFT 12 User Guide

 

  • GetDataSource.
    • Type: Method
    • Usage: Accesses the "dataSourceNameToDataSource" object (see below) to locate and interact with data sources on API scripts
    • Examples:

      • Get Value from "LocalTable1" (Local table), on row index 0 (zero) on "Column1" column:

        string val = GetDataSource("LocalTable1").GetValue(0, "Column1").ToString();

      • Get value from "Book1!Sheet1" (Excel table, Book1.xlsx, Sheet 1), on row index 1, on "ExcelColumn2" column:

        string val = GetDataSource("Book1!Sheet1").GetValue(1, "ExcelColumn2").ToString();

  • dataSourceNameToDataSource.
    • Type: Instance of an object
    • Usage: Collection of DataFetchActivity classes (see below), hosting all Data sources on API script

  • DataFetchActivity.
    • Type: Class Activity
    • Usage: Direct connection to each of the Local, Excel, or XML tables.
    • Note: Each sheet on XLS/XLSX files are represented by a separate DataFetchActivity

 

regards.
 
” If you find this or any post useful to resolve the issue, please mark this thread as correct answer and other members can benefit with the information given”
Ruddy Alvarez H.
Customer Support Engineer

If you find thst aat this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the pond show your appreciation.
Highlighted
Outstanding Contributor.
Outstanding Contributor.

You can get the innertext from the WebObject (not sure abt the object type) by using GetROProperty methoid and specifying the innertext property. GetROProperty("innerText")

xmlContent = Browser().Page().WebElement().GetROProperty("innerText")

Then load the string to create XML doc. Refer help for more details. Working with XML

_____________________
Rajkumar Rajangam

View solution in original post

Highlighted
Absent Member.. Absent Member..
Absent Member..

Thanks for the information!

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

This is really helpful. Thanks!

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Hi, 

You can also find related information in our online help center:

XML checkpoints

Manipulate data programmatically

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.