Interact automatically with a web page on ios

Hello,

I’d like to automate an action that consists of clicking on a web page and uploading a file as part of a shortcut.

The javascript executor in shortcut allows to check if the code works
directly on a safari page via the share sheet, but this action doesn’t allow automatic chaining with other action blocks.

Is it possible to do this in the shortcut application?

this action doesn’t allow automatic chaining with other action blocks.

I’m afraid I don’t understand – what kind of chaining do you want to do?

Sorry for the inaccuracy, I’d like the code to run directly without going through the share sheet.

I’ve found templates that use text and url actions (same base 64 encoding), but no example of code similar with what I want to do.

Precisely what I’m repeating manually:

  1. go to the page in the browser (open safari)
  2. click in the right place (js selector css)
  3. upload my image file to the site (a click in the area opens the file explorer and I always choose the first on the list in the right folder)
  4. wait for analysis
  5. retrieve the prompt (click on the button to copy to clipboard: js selector css)

Operations 2, 3 and 5 require a script. I’ve managed to test that 2 and 5 work correctly with the execute js action on safari (thanks gemini for the code) without managing to do so with other actions that wouldn’t require the manual share operation, but for 3 I can only manage to retrieve the url of my file in the shortcut…

Thanks for the clarification, I got the picture now. I doubt you can pass an actual file (from a share sheet or workflow input) to a web page form using a “Run Javascript” action – or any other action, for that matter. Therefore, I doubt that a full automation on iOS is possible.

(The situation on macOS isn’t much better but at least there are more available workarounds.)

That said, even if you probably won’t be able to 100% automate everything, maybe you could make step 3 click on the upload button in the page so the Files explorer will open automatically, and you’ll only have to find the right file?

yes, that’s where I’m at, everything else is a shortcut.