Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda