Not clicking the Radio Button when using the Xpath

Recently, learned how to select a radio button using the Xpath for the Chrome browser. However, sometimes in a form, the Radio Button is not selected when using the assigned Hot Key trigger to it because it states there is no radio button. Sometimes, the best method that works is using an image found click in Chrome. When clicking on the image the Radio button is selected with the found image click. In some of the forms the Hot Keys work with the radio button macro by using the Xpath. Is the Xpath not working because of different format in form versus other forms?

Have provided some images below:

The Xpath could fail if the web page varies, or if the web page has frames. It could also fail if you haven’t allowed the page to load fully.

When the page varies. Are you referring that sometimes the page may have something like this “hidden values” it is usually above the radio button ? The page did load fully. Would you mind explaining a little short description what you mean by web page frames?

Thanks for the reply @peternlewis, making an effort in reading, trying to learn, and solving some of the issues on my own before asking questions.

The web page can vary at any time for many reasons. It could vary from load to load depending on advertising or other features. The changes could be visible or invisible. The form order could be changed, there could be more or less divs, whatever.

And there are many reasons that Keyboard Maestro cannot see something on a web page. The most common I’;ve seen are frames - Keyboard Maestro cannot see into frames on a web page.

XPath you are using is pretty robust, it finds the page item with id Sentiment, and then looks at its children, the second div, the first label within that and the first input within that.

If the web page is public, I can have a look at it, otherwise your best bet is to figure out the JavaScript you need and use that directly.