Why this is tricky

The widget below attaches an open shadow root — document.querySelector and regular CSS selectors from the main page won't see inside it. Your tool needs to explicitly cross the shadow boundary (e.g. element.shadowRoot) to reach the button and counter.

Initial state.