I'm trying to retrieve the outer html of a matrix table to copy it to Excel. The problem is that I can't provide an url because it's login-based. When I perform the manual steps:

  1. Click on Inspect.
  2. Go to console
  3. Enter "document.querySelector("#matrixAnchor").outerHTML" in the console and press enter. It will show me the desired results:

When I try this with a KM macro with a "Execute Javascript in Front Browser"

and checking the console. I'm getting this error:

CleanShot 2023-06-19 at 10.45.04

Why is this happening? Is there a workaround?

Apparently you should be using #matrix instead of #matrixAnchor in Execute action because the latter don't exist hence returning null.

Thanks @macdevign_mac the id is correct. The problem is within the context

CleanShot 2023-06-19 at 20.39.38

I need to have this one selected then it's working:

CleanShot 2023-06-19 at 20.40.27

This value is dynamic so I need some logic to set it to "contains vfFrameId"
But I don't think this can be automated....