1

Okay, relative newbie here, but I have searched all the answers and tried most of the suggestions and cannot find a way to automate using Applescript or Javascript within Applescript to click a button on a specific website. I can't provide the website because it is part of a protected medical record software, but as far as I can tell the button is encoded as follows:

  <h3>Add new documents for this patient
         <!-- The fileinput-button span is used to style the file input field as button -->
        <span class="btn fileinput-button" style="float: right !important;">
            <i class="icon-plus"></i>
            <span>Add Files</span>
            <input type="file" name="files[]" multiple="">
        </span>
    </h3>

I have tried most of the Javascript (and Applescript) solutions. I have even tried the Fake app which seems to work for every other button except this one. I have searched in vain for a button id and the above code seems to be all that refers to the button. The function of the button is to bring up a Chooser window import image files.

Using tab to get to the button doesn't work because the number of tabs varies with individual patients (dynamic website ?).

I apologize in advance if this is trivial, but it is literally the last step in a long series of steps that would save me a lot of time. I figured out everything else mainly with the help on this board.

Screen shot of page in question. It is the "Add Files" button ? that I want to click

Thanks to all of you.

2

I found my own answer by digging a little deeper into this.

tell application "Safari"


do JavaScript "document.getElementsByName('files[]')[0].click();" in document 1


end tell

Using getElementsByName and the name attribute 'files[]' was all it took (and by the way was the ONLY way out many, many that worked in this case).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .