Highlighted
Absent Member.. Absent Member..
Absent Member..
990 views

How to perform a autosubmit with Vugen (http protocol)

Hi folks,

In my HTTP/ HTML script I am facing a problem to submit an request. The request is autosubmit lanching by a javascript.

During the recording, for submiting my form I pressed ENTER, but any parameterwas recorded...

Dev explained me that there is an autosubmit in the page.

Here is the HTM code :

<href="javascript&colon;__doPostBack('ctl01$SubmitButtonLink','')">OK</a>

I try a web.link function :

web.link(
    {
        stepName : 'OK', 
        text : 'OK', 
     //   snapshot : 't2.inf'
    }
);

But I have this error in return  Invalid scheme (not "http:" / "https:" / "ws:" / "wss:") in "javascript&colon;__doPostBack('ctl01$SubmitButtonLink','')"

My question is there is a way to perform a Javacript action in Vugen. 

thanks for your responses.

Best 

Romain

 

0 Likes
3 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: How to perform a autosubmit with Vugen (http protocol)

Hello,

The Web-HTTP/HTML script is simulating http traffic, not user action.  During recording, you can insert comment before and after pressing the 'OK' button. so it will be easier for you to locate the web steps generated for the 'OK' action. It may be a web.customRequest step or web.submitForm step.

LR is able to run any JS code as you're using JS scripting language. But LR will not 'know‘ a JS function defined in server response during replay, unless you explictly load the JS code. 

Regards,

Bingle(LoadRunner R&D)

 

 

Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: How to perform a autosubmit with Vugen (http protocol)


@BingleW wrote:

Hello,

The Web-HTTP/HTML script is simulating http traffic, not user action.  During recording, you can insert comment before and after pressing the 'OK' button. so it will be easier for you to locate the web steps generated for the 'OK' action. It may be a web.customRequest step or web.submitForm step.

LR is able to run any JS code as you're using JS scripting language. But LR will not 'know‘ a JS function defined in server response during replay, unless you explictly load the JS code. 

Regards,

Bingle(LoadRunner R&D)

 

 



Thanks for response BingleW,

Do you have any example, how to run JS code into LR. I never done that before.

In my case for submitiing my form I know that I have to make a onkeyup on my field, and then press "Enter".  

Thank you for your help.

Romain

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: How to perform a autosubmit with Vugen (http protocol)

Hello,

Your original question has been solved,  is it? Web/Http protocol is focus on network traffic, it doesn’t concern of whether you press ‘Enter’ or make a ‘onkeyup’. Just make sure that the Http(s) traffics of these ‘UI’ actions has been recorded and the script is replay-able, then it’s OK.

If you’re concerning of simulating the UI actions, you can use TruClient protocol. 

For your question of run JS into LR, in web/http protocol, you can add any JS code into the JS files appears in LR project. These files will be evaluated on V8 engine when running VUser.  The only special thing is the special functions (vuser_init, vuser_end Action, …   ) will be called automatically and following the ‘Run Logic’ settings.

You can also use lr.loadLibrary(<path>) to evaluates and runs the specified JavaScript file in the global context, and use lr.require(<path>) to load a JS module, which is similar to Node.js’ ‘require’.

Search these two functions in “Help->Function Reference->Index”, there’re sample codes.

If using TruClient protocol, we can add ‘Evaluate JavaScript Code’ steps to run piece of JS code.

Regards,

Bingle

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.