Didn’t realize you could do that. How much access do apps have to browser state ?
Discussion
Seems you can do quite a bit, even inject JavaScript, etc...
https://developer.apple.com/documentation/webkit/wkwebview
See:
https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript