#StackBounty: applescript getInputByClass2 with Safari 10.1

Bounty: 50

I used to have this AppleScript to get a list of all the “dataPersonId” from a raw on Safari.

set dataList to my getInputByClass2("sortable dataPersonId", 1)

to getInputByClass2(theClass) -- this return a list of values
    tell application "Safari"
        set r to do JavaScript "var outPut=[]; var arr=document.getElementsByClassName('" & theClass & "');for (var i in arr) {outPut.push(arr[i].innerHTML)};outPut;" in document 1
    end tell
    return strings of r --- this remove  'Missing Value'
end getInputByClass2

Since I updated to safari 10.1, I have an error :

The variable r is not defined. (-2753)

I try set r to missing value but same issue.
how can I fix that? thanks.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.