question

anthony.tancredi avatar image
anthony.tancredi Suspended asked anthony.tancredi Suspended answered

Extracting data from HTML

I have an html file that has some data that I have to extract. Specifically I need to store the value "97" from this selection of data: 128 96.875 409101 409101 409101 81820 97 I already read in the file using readFile. So I tried adding an analysis rule by highlighting 97 and storing it into a variable, but I guess it stores the regular expression which is associated with 97 instead of that number. While it does this, a list of numbers are stored in my variable such as 40901, 81820, 97 and so on. Also my second question, is it possible to dynamically store that value into a variable, so if I ran a test with different numbers, the new value where 97 would be gets stored in the variable. I really appreciate any help I can get. Thank you
iTestVariableshtml
10 |950

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

koelze avatar image
koelze answered
Would it be possible to read the HTML file via a web session instead, and then use a getTable action to get the value of the entire table, and then you should be able to pick the appropriate cell (the response should give you appropriate queries to extract). And yes, you can store the value in a variable. The easiest way to do this is to add an analysis rule: query the value that you want, and rather than setting the next step to "assert", set it to store, and you can store the extracted query value into the variable you choose.
10 |950

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

lakshminarayana avatar image
lakshminarayana answered
And we can also use "Quick Analysis Rule" from Queries view to extract the required value. ![alt text][1] [1]: /storage/temp/3544-sample.jpg

sample.jpg (58.4 KiB)
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.

anthony.tancredi avatar image anthony.tancredi commented ·
Thanks Koelze and lakshminarayana. The web session was a lot simpler to use than the readFile command!
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.