Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
AppleScript: Triggering input file with .click() doesn't actually attaches a file

What I have in here is a page manipulation through Safari using Javascript.

set eshopwedropUrlDialog to display dialog "Eshopwedrop Item URL" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
set eshopwedropPriceDialog to display dialog "Price" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"

set eshopwedropUrl to text returned of eshopwedropUrlDialog
set eshopwedropPrice to text returned of eshopwedropPriceDialog

tell application "Safari"
    make new document with properties {URL:eshopwedropUrl}
    activate
    set jq to do shell script "curl https://code.jquery.com/jquery-latest.min.js"
    do JavaScript "$('.customs-banner').hide();" in document 1
    do JavaScript "$('#dg_no').click();" in document 1
    do JavaScript "$('#address_id').val('23118').change()" in document 1
    do JavaScript "$('#prices_0_price').val('" & eshopwedropPrice & "')" in document 1
    do JavaScript "$('#lion_upload_btn').click()" in document 1
end tell/

tell application "System Events"
    keystroke "G" using {command down, shift down}
    delay 1
    keystroke "~/Downloads/ebay.png"
    delay 1
    keystroke return
    
end tell



This particular line do JavaScript "$('#lion_upload_btn').click()" in document 1 doesn't work well. It does opens Finder window and picks up a file, but within the web page no file is attached. I think this might be due some custom handler used within jQuery code on that web.

As this page requires login I'm providing a gist link to the source. In a file functions.js SimpleUploader library is used. I can't find the trigger anywhere, not even sure how to debug it. I think there should be some kind of a handler which takes control of click() event, does some logic before file is even picked, and does some logic after file is picked (because it shows file list when they are attached). I believe I need to call that particular handler in order to have correct file attachment.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!