Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda