@momlo Thanks for the tips. I figured out the primary issue is the browser type. The javascript action seems to only work with Microsoft Edge. I am also unable to explain the intermittent success I'm having with this javascript action. Yesterday, I was able to get it working by starting the developer console. Then my javascript action seemed to work just fine, even after I closed it. Today, without making any changes to my flow, the same logic won't work.
One thing I noticed is I was getting a message in Edge when the javascript action triggers that says "Edge is being debugged" or something of that sort. Today, I'm not getting that at all.
Any help with this behavior would be appreciated. This is very annoying, and I've been wasting my time doing trial and error to figure out this issue, but to no avail.