The Runner JavaScript API exposes many properties of generated page objects, but often I need to do something beyond what is available in the API. Current case in point: I've created a custom button and would like to change the text of the button following a user click. There doesn't seem to be a way to change the Javascript native "textContent" property of a button using the API. So, I tried using straight JavaScript, as in:
document.getElementById(buttonID).textContent = buttonText;
This works, but only if you know the element ID. I naively thought I could examine the source code after a build and use that ID. And it worked when I did the first test. But I discoevered that the ID of a given element can change in successive builds by ASPR.
So my question is, how can I accomplish this? Am I overlooking something obvious? Any guidance would be much appreciated.
—Pete