Absent Member.
Absent Member.
2040 views

WebVerifyData for string verification

Jump to solution

I am having issues using the WebVerifyData function to determine if a certain string exists on a JSON script page.  I know that the string is there, but the result is always 0.  Here is my code:

WebVerifyData("ATL_FORM", SEVERITY_ERROR, nVERIFY);

Even though that string does exist on the web page, the function does not find it.  Thank you so much for your help on this!

0 Likes
1 Solution

Accepted Solutions
Absent Member.
Absent Member.

For your sanity, capture the response in a string and print it out.  Verify what you expect is being captured.

If it is indeed being captured then there is something wrong with the way you are calling the WebVerify function (jonny's suggestion) or it may simply not work for your use case.  If you can verify the text exists you can manually search for the text using a simple string search like this:

sText := some web response capture function...

iResult := StrSearch(sText, "What I'm looking for", STR_SEARCH_FIRST);

       print("StrSearch result: " + iResult);

       if ( iResult = 0 ) then    

         RaiseError(0, "Success verification failed   " + what_im_looking_for + " was not found...", SEVERITY_TRANS_EXIT );

       end;

View solution in original post

0 Likes
4 Replies
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

try specifying more parameters in the function.  In particular, you have no nOptions parameters which means the default used is WEB_FLAG_GREATER, however you also haven't specified nAppearance (against which the greater than parameter compares) so maybe that's the problem.  If the value occurs only once then try changing the function like this:

WebVerifyData("ATL_FORM", 1, WEB_FLAG_EQUAL , SEVERITY_ERROR, nVERIFY);

If that doesn;t work, check that the value isn't actually coming in as part of the header or embedded content - if it is then specify those flags instead.

0 Likes
Absent Member.
Absent Member.

Hello Jonny,

I tried the code as suggested, but I am still getting the same results.  I also tried WebVerifyContent, but in that case I am always getting TRUE as a result, even if the string is not there.  Could JSON be the issue?  The header/embedded content is not an issue.  Any suggestions you might have would be appreciated!

Thanks!

0 Likes
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

You might need to try WebVerifyDataBound or WebVerifyDataBoundEx with bounds specified.  If you  cannot get it to work please log a support incident.

0 Likes
Absent Member.
Absent Member.

For your sanity, capture the response in a string and print it out.  Verify what you expect is being captured.

If it is indeed being captured then there is something wrong with the way you are calling the WebVerify function (jonny's suggestion) or it may simply not work for your use case.  If you can verify the text exists you can manually search for the text using a simple string search like this:

sText := some web response capture function...

iResult := StrSearch(sText, "What I'm looking for", STR_SEARCH_FIRST);

       print("StrSearch result: " + iResult);

       if ( iResult = 0 ) then    

         RaiseError(0, "Success verification failed   " + what_im_looking_for + " was not found...", SEVERITY_TRANS_EXIT );

       end;

View solution in original post

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.