Tests on HTML response - Need Help

Hi, I am trying to parse my HTML response for a test to see if the values coming back are valid or not

Here is my sample HTML response body
< tr >
< td >TRAN Connect Status< /td >
< td >UP< /td >
< /tr >

I am trying to check the Tran Connect status by using tests if its UP or not.
I am using the following test script
pm.test(“Body is correct”, function () {
pm.expect(pm.response.text()).to.include("description to be searched here
});

I am able to search < td >TRAN Connect Status< /td > using above command, However I am unable to search both the lines
< td >TRAN Connect Status< /td >
< td >UP< /td >

Any help or suggestions will be appreciated. Ignore the syntaxes in HTML above. After saving the post here, my HTML syntaxes are messing up

@karumuriabhishek

Sounds like you could benefit from using cheeriojs to extract the values from the html response and then test against those variables.

Looks like this problem was solved before by @danny-dainton here, Parse HTML form response data

1 Like