Big news! The community will be moving to a new platform April 21. Read more.
Big news! The community will be moving to a new platform April 21. Read more.
Absent Member.. Absent Member..
Absent Member..
245 views

web_reg_save_param_regexp in Vugen

Jump to solution

I'm having an issue using web_reg_save_param_regexp in Vugen. I need to grab the "href" parameter from the following HTML code:

 

    <a href="/some/url/here/">
    
        <img src="/some/other/url/here.gif" border="0" align="absmiddle"/>
    Foo</a>

 

I have found this href parameter to be anywhere from the second to the fourteenth on the page, so using "ORDINAL=" to find the position doesn't work. As a result, I elected to use web_reg_save_param_regexp.

 

According to the web_reg_save_param_regexp reference in Vugen, a valid Perl regex will work in this function. I've built and tested the following regex, which correctly extracts the URL I'm looking for:

 

/href=\"(.+)\">.+Foo<\/a>/si

 

However, when I insert the following code into Vugen, it complains that the specified parameter can't be found:

 

web_reg_save_param_regexp("ParamName=Correlation1",
                          "RegExp=<a href=\"(.+)\".+Foo</a>",
LAST);

 

I assume that this is because the source HTML in the page spans multiple lines, but there does not appear to be an equivalent to Perl's "s" flag, which allows the regex to span multiple lines.

 

Unfortunately, the href is dynamicly generated each time the application runs, so I can't just hardcode it, and I am not the author of the webpage, so glomming all this together into one line in the page source is not an option.

 

Help? Am I missing flags for this function? Is there a better way to do this with a different web_reg_save_param_* function?

 

Thanks.

0 Likes
1 Solution

Accepted Solutions
Fleet Admiral
Fleet Admiral

Hi,

 

I think that the regular expression should be additionally customized as it currently does not capture the value you have provided because it is not checking if the string contains white spaces and the new lines.

For other question if  web_reg_save_param_* can be used in this case, I will need to review the script you have recorded and the response from the server you receive. Will it be possible to upload it?  

 

Kind regards,

Vesela

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.

View solution in original post

0 Likes
1 Reply
Fleet Admiral
Fleet Admiral

Hi,

 

I think that the regular expression should be additionally customized as it currently does not capture the value you have provided because it is not checking if the string contains white spaces and the new lines.

For other question if  web_reg_save_param_* can be used in this case, I will need to review the script you have recorded and the response from the server you receive. Will it be possible to upload it?  

 

Kind regards,

Vesela

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.

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.