question

gbod avatar image
gbod asked amichaels commented

Double variable return when storing it from iTest WEB session

I am using iTest to get some values from WEB page.

Particular information is in HTML table.

I am using query to parse the value

query //TABLE[2]/TBODY/TR[6]/TD[2]

But when I examine the returned variable I see that the single word in the table field has doubled.

On web I see Disconnected but in response I get Disconected, Disconected

The page refreshes itself every couple of seconds in the particular table is populated with JavaScript.

Could JavaScript be the reason to get the double back? because in JavaScript there is line:

document.writeln( "<td>Disconected</td>");

I have already enabled "Store single match in the list".

iTestweb sessions
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
gbod avatar image
gbod answered amichaels commented

Fixed the issue. Just have to modify the query to:

mapped/Xml/WebDocument/Document[4]/HTML/BODY/BLOCKQUOTE/FORM/TABLE[2]/TBODY/TR[6]/TD[2]
1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amichaels avatar image amichaels ♦ commented ·

You have found the right way to approach the issue. Since there are 2 versions of the HTML document inside the response, your original XPath expression will get both values. You can make your new XPath a little less specific so that it doesn't break in the face of some HTML changes. Another way to achieve this would be to use a response map to create a named query so that if the HTML does change, you can update the XPath in your response map without needing to change your test case.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.