automator fifa 19 web app I'm trying to click the reset button in Fifa 19 web app with automator. 



codes I've tried. 

tell application "Safari"
    activate
    tell current tab of window 1
        do JavaScript "document.getElementsByClassName('btn-standard')[0].click()"
    end tell
end tell


second one 


to clickClassName(theClassName, elementnum)

  tell application "Safari"
      activate

      do JavaScript "document.getElementsByClassName('" &amp; theClassName &amp; "')[" &amp; elementnum &amp; "].click();" in current tab of first window

  end tell

end clickClassName
clickClassName("btn-standard", 0)



nothing works any idea why ? I know I can do it with watch me do, but I want to click this button with java script. 

After some research it seems that they are more btn-standard tags so is there any way to first select the class="button-container and then the class  btn-standard ? Maybe I'm not selecting the button correctly
This should work for you

tell application "Safari"
    activate
    do JavaScript "document.getElementsByClassName('btn-standard')[0].click();" in document 1
end tell




When in doubt, You can always use APPLESCRIPT MAKER  Which will create the correct JavaScript for you

I'm not really sure because I never use Safari but maybe enabling "Allow JavaScript from Apple Events" Needs to be enabled?