Highlighted
Absent Member.
Absent Member.
1180 views

Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

Working with LoadRunner 12.50 and using TruClient to record scripts, I discovered a probable bug in an if-else workflow. To be precise, I have the following if-else workflow:

 

IfClause.png

In the 'if' step, I am trying to identify an object using descriptors (first red box). Depending on the result, one of the two following steps are being executed.

However, when I click on "Click here to edit" to edit the descriptors of identifying an object in the first red box I can edit e.g. the ID:

 

IfClauseDescriptors.png

But afterwards, also the descriptors for the else-clause (second red box) are being changed accordingly!

Again: When I edit the descriptors of the if-clause, the descriptors of the else-clause change as well. I am not able to change the descriptors of one box seperately! I hope my description is clear...

Is there a workaround of this probably bug? Otherwise I cannot use the if-else clause...?

Is this bug known to the LR team?

 

Additional information: I tried to replace the else-action by a kew function "Generic Object Action", which does not solve my problem. A change for the descriptors in the if-block changes the descriptors in the else-block again...

0 Likes
1 Solution

Accepted Solutions
Highlighted
Super Contributor.
Super Contributor.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

hi alex,

First, suggest you deleting your current IF ELSE clause including the sub steps in the clause, or just create an empty script.
And here I suggest you 2 solutions:

Solution 1:

1. drag & drop an "IF Exists" step from toolbox, select the "okButton" as the target object in the IF step by clicking it on UI, change the object's ID method to descriptor, set the ID property to "okButton".

step1.png

 

 

 

2. drag & drop a "Generic object action" step into the IF clause, select the "okButton" as the target object by clicking it on UI, change the object's ID method to descriptor (please note, the object in this step and the object in step 1 are the same, they point to the same source object "okButton" in TruClient script's source file, that means, if you change the object's descriptor property in one step, the object in another step will also be chagned.)

step2.png

 

 

 

3. drag & drop a "Generic object action" step into the ELSE clause, select the "proceedWithoutSelectionButton" as the target object by clicking it on UI, chagne the object's ID method to descriptor and edit the property ID to "proceedWithoutSelectionButton".

step3.png

 

 

 

some tips:
1. if you can't easily set a target object by clicking it on UI, you can try to use the suspend feature by clicking the "Ctrl + Alt + F4" to suspend the selection, to make your target object available and click "Ctrl + Alt + F4" again to cancel the suspend then select your target object, this usually suit for some objects that only available when "mouse over".
2. if you can't easily set a target object by clicking it on UI, and the tip 1 is not suitable for you, you can workaround it by clicking an available button that isn't used in your script, then change the object's ID method to descriptor and set ID property to "proceedWithoutSelectionButton")

---------------------------------------------------------------

Solution 2:

1. drag & drop an "evaluate javascript" step from toolbox, write below JS code:

var okBtn = document.getElementById('okButton');
var proceedBtn = document.getElementById('proceedWithoutSelectionButton');
if (null !== okBtn){
okBtn.click();
}else {
proceedBtn.click();
}

js_solution.png

 

 

 

 

 

 

View solution in original post

7 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

hi alex1703,

from your snapshot, I think the root cause is that the two objects actually point to the same source target, that's why they are look like "linked". (you can see the two objects' Roles and Name are same).

If you aim to perform operations on different objects in the ELSE clause, then suggest you to replace the object in ELSE clause to other object.

Thanks,

Penn

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

Hello Penn,

I did replace the step, as I noted in my question. I inserted a new step "Generic object action" and removed the old step. But still, when making a change in the one object it changes the other object.

So what do you suggest?

Toolbox1.png

Insert a "Wait" step instead? Or "Verify PDF Content"? How can any other step be used to click on a button on the current page? Or what exactly did you suggest...?

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

Hi alex,

can you try to use the "replace" button to replace your object which is in the ELSE clause?

And which browser you're using?

222.png

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

I am using the browser that is shipped with LR 12.50 (Firefox, Version 37.0.2).

I cannot click on "Replace" to replace the object, since I cannot recreate the situation easily. But I know exactly what ID to use to identify the object in case the other object is not present.

Here again the steps I am trying to do:

IF there is an object with id=okButton

THEN click on object with id=okButton

ELSE click on object with id=proceedWithoutSelectionButton

 

But the condition in the else clause is something I cannot recreate myself. But I know what object to look for...

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

you don't have to replace the obejct in the ELSE clause to your target object directly, just replace it to any other avaiable object except the object in the if step. After replace, edit your new object's descriptor to the ID that you want to.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

I still do not understand what you suggest. I thought I have explained my case exact enough, but here it is again:

I want to check if an element is available on the current page with the id="okButton". If that is the case, I want to click on the element with id="okButton". If I do not find an element with id="okButton", I want TruClient to click on the element with id="proceedWithoutSelectionButton" instead.

Please explain step by step and very very precise and in very detail, how I should do that in TruClient. I also have just the information I presented, I do not have additional information. Please explain, how I can implement the if-else-clause...

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Is there a workaround for a if-else workflow bug in TruClient?

Jump to solution

hi alex,

First, suggest you deleting your current IF ELSE clause including the sub steps in the clause, or just create an empty script.
And here I suggest you 2 solutions:

Solution 1:

1. drag & drop an "IF Exists" step from toolbox, select the "okButton" as the target object in the IF step by clicking it on UI, change the object's ID method to descriptor, set the ID property to "okButton".

step1.png

 

 

 

2. drag & drop a "Generic object action" step into the IF clause, select the "okButton" as the target object by clicking it on UI, change the object's ID method to descriptor (please note, the object in this step and the object in step 1 are the same, they point to the same source object "okButton" in TruClient script's source file, that means, if you change the object's descriptor property in one step, the object in another step will also be chagned.)

step2.png

 

 

 

3. drag & drop a "Generic object action" step into the ELSE clause, select the "proceedWithoutSelectionButton" as the target object by clicking it on UI, chagne the object's ID method to descriptor and edit the property ID to "proceedWithoutSelectionButton".

step3.png

 

 

 

some tips:
1. if you can't easily set a target object by clicking it on UI, you can try to use the suspend feature by clicking the "Ctrl + Alt + F4" to suspend the selection, to make your target object available and click "Ctrl + Alt + F4" again to cancel the suspend then select your target object, this usually suit for some objects that only available when "mouse over".
2. if you can't easily set a target object by clicking it on UI, and the tip 1 is not suitable for you, you can workaround it by clicking an available button that isn't used in your script, then change the object's ID method to descriptor and set ID property to "proceedWithoutSelectionButton")

---------------------------------------------------------------

Solution 2:

1. drag & drop an "evaluate javascript" step from toolbox, write below JS code:

var okBtn = document.getElementById('okButton');
var proceedBtn = document.getElementById('proceedWithoutSelectionButton');
if (null !== okBtn){
okBtn.click();
}else {
proceedBtn.click();
}

js_solution.png

 

 

 

 

 

 

View solution in original post

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.