Search a string in a local HTML file, displayed in a browser

Does someone have a solution to search for a string in an HTML file that I have loaded in Brave? (E.g. via AppleScript)

The browser isn't critical here.

I normally do this with a sledgehammer approach like this:

Test Search HTML.kmmacros (3.1 KB)

Click to see macro

Keyboard Maestro Export

I first get the source HTML of the page in the browser into a variable and then use the KM search action with an appropriate regex.

As long as %FrontBrowserURL% works for Brave, you're all set.

Or perhaps you can just load the file into a KM variable and perform the search on that in a similar way?

1 Like

I have this:

When I perform the actions manually, the content of the tiny input box is selected:

Screen Shot 2022-07-11 at 12.59.33

When I run the macro, this isn't the case. How come?

For clarification -- do you want to search the HTML of the loaded URL or the content of the loaded page? @tiffle's given you the first, your screenshot is the second.

1 Like

Sorry for being unclear @Nige_S, I meant the content of the loaded page.

Actually, this simple approach works fine: