Web Area not running one JavaScript command, but other runs

I had to build OAuth2 with one site using only Authorization flow and the backend doesn’t allow the use of cURL or HTTP Client commands.

I have a form displayed in Web Area which I must submit using click() on the button, if I use submit() the backend return “Access denied” error.

So, on my Mac the following code:

<code 4D>
$js:=“document.getElementsByTagName(‘button’)[0].click();”
$result:=WA Evaluate JavaScript(*;“MY_WA”;$js)
</code 4D>

is working, but on the client computer and their server it is not. Even manually clicking on that button in Web Area is not working.

This is in 32-bit v17.2, macOS Mojave with latest updates on all computers.

Any ideas why could this happen?

To make it more complicated:

<code 4D>
$test:=WA Evaluate JavaScript(*;“MY_WA”;“document.getElementsByTagName(‘button’)[0].value”;Is text)

If ($test=“yes”)

$js:="document.getElementsByTagName('button')[0].click();"
$result:=WA Evaluate JavaScript(*;"MY_WA";$js)

End if
</code 4D>

First JavaScript executes and returns the string, but the second is not.