LoadRunner Truclient v2023 build 628
The xpath of the object changes dynamically. We are able to capture these dynamic values and pass it in the xpath but it works as expected only the first time after the Object is identified on the screen. When we navigate to other screens or replay the script again, object identification fails even though the dynamic values of the xpath are captured correctly and this has been verified.
We were somewhat able to overcome this issue by using Evaluate JS code for the click but the first time we replay this script the step passes without actually clicking the button but from then onwards it works as expected every single time - even on navigating to other screens and coming back(when the dynamic values would change).
Evaluate Javascript code -
var Button = document.querySelector("#panel-body2-panelABC > EFG-field > div > div > "+ArgsContext.Global.result2+"").shadowRoot.querySelector("#form-group-btnViewXYZ > div > button > span."+ArgsContext.Global.result4+"-vt.button-label.ABButton-button-label-text");
Button.click();
Global.result2 and Global.result4 are the two dynamic values being captured when the page loads. We print this value to TC log and have verified the values when the click fails.