Hey Kyu,
Use a Wait For Google Chrome to Finish Loading action instead of a plain pause.
I don’t see a verb in Chrome’s AppleScript dictionary for getting the page text, but you can do it with JavaScript.
Using an Execute an AppleScript action:
------------------------------------------------------------
set javascriptStr to "document.body.parentNode.outerText"
tell application "Google Chrome"
tell front window
tell active tab
set chromeFrontPageText to execute javascript javascriptStr
end tell
end tell
end tell
------------------------------------------------------------
Or try the bare JavaScript in an Execute a JavaScript in Google Chrome action.
Beware – all of Chrome’s actions are run via AppleScript, and sometimes Chrome’s AppleScript support breaks – requiring a restart of Chrome.
I doubt there will be any difference in the reliability of either of these actions, so the bare JavaScript will be cleaner.
Route the output of the action to a Keyboard Maestro variable.
You have a number of options for finding your word or phrase:
- AppleScript
- JavaScript for Automation
- Keyboard Maestro Search action
That should get you started.
-Chris