Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.
Raviteja3 Contributor.
Contributor.
466 views

Loadrunner - Perform Right click using Javascript in TruClient

Hello All,

 

Do we have any javascript command to emulate "Right click" operation on a specific object in TruClient.

For left click, we have object.click();  Need the similar logic for Right click operation.

 

Appreciate your help on this.

 

Regards,

Ravi

0 Likes
7 Replies
Edo Nir Outstanding Contributor.
Outstanding Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

You can edit the TruClient Click step to Trigger a different button.

To do this, go into the Arguments section and change the Button value.

You can also set click modifiers (Shift, Ctrl or Alt).

0 Likes
Raviteja3 Contributor.
Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

Thanks for update.

But my question is about not to use general click and updating arguments. 

Using "Evaluate JS on object", what is the command to pass in the argument to emulate right click operation.

 

Thanks,

Ravi 

0 Likes
Edo Nir Outstanding Contributor.
Outstanding Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

Evaluate JS step performs a standard JS script on the browser object.

object.click() is not a TruClient API, but rather a JS function.

Similarly, there is not built-in TruClient API for right clicks.

You can try to find the JS way to do it on Google. Something like this (just to clarify, I did not test it).

0 Likes
Raviteja3 Contributor.
Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

Thank you for update.

 

Yeah, I am pretty much looking for "JS function" to do "right click". I tried with "object.contextmenu()", but didn't work out.

To give a headsup, we have multiple buttons which will be selected randomly. "Left click" on it has one operation and "right click" has another. For left click, I am using "Object.click()" JS function without any issues. Currently am looking for JS function which performs right click in Truclient protocol. Tried multiple ways but couldn't succeed.

 

Let me know if any details required.

 

Thanks

Ravi

0 Likes
Highlighted
Edo Nir Outstanding Contributor.
Outstanding Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

Thanks for the clarification.

I realize this is not what you asked, but you can implement such a logic quite easily with TruClient steps.

Use a random number and If steps to create a flow that performs different clicks.

See this screenshot:TC Random clicks.png

Edo

0 Likes
Raviteja3 Contributor.
Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

Thank you Edo.

 

Now we are getting closure on the need. In the below details you shared, can we replace the highlighted with "Evaluate JS on object" function to perform the same operation


TruClient.JPG

Below is the one I am using for left click. Looking for the JS logic/function to perform right click.

Capture.JPG 

Thanks

 

0 Likes
Shlomi Nissim Acclaimed Contributor.
Acclaimed Contributor.

Re: Loadrunner - Perform Right click using Javascript in TruClient

You should replace the code with a code that triggers right click on an element. The element in your case is the object.

Check this post as a reference: https://stackoverflow.com/questions/7914684/trigger-right-click-using-pure-javascript

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.