how to input an html document in javascript action in automator

Hello,
I’m trying to create an automator action that records and process a web page through :
first a web archive ( the page is a bank statement, that I can see on my screen, but cannot record directly )
then extract the html page from the archive ( via textutil ) which is the Apple converted form
then extract parts of the web page through a series of javascript functions like
var xyz = document.getElements…textContent and process these further to format them etc…
I can reach the state where I can have the “local” web page opened in Safari, but I cannot go any further
I’ve tested the javascript script outside automator and it is working but I cannot find the way to get the correct input parameter that will enable the var xyz = document.getElements…textContent functions in the run javascript action in automator ?
How could I pass the html file as a DOM element ?
I cannot use Applescript because I want as much of my actions and codes to be usable in iOS devices as well (Shortcuts) and there I cannot use AppleScript…

Thank you for any help, I’ve been searching this for months now…

Model: MacBook Pro 13"
Browser: Safari 537.36
Operating System: macOS 10.14

Thanks for the indication, but I would like to avoid using Applescript altogether

I don’t know how to tell automator to run a “browser” javascript in an html file with the automator action “Run Javascript”, if it makes sense at all ?
The corresponding “Shortcuts” action works with safari pages as input…

The Run JavaScript action is for running JXA, or JavaScript for Applications, code. JXA is like AppleScript written in JavaScript. It’s not for direct browser scripting.

Thank you very much for clarifying this…
My “dream” of using the same javascript script in automator and shortcuts goes away…
I’ll have to do with this…