I am writing a little tampermonkey script to click a button called "Close Contact" in the Amazon AWS Connect softphone (used for customer service) if it appears because I keep forgetting to do it after calls at work. The problem is, the softphone is in a popup window. I can see the URL (although I will not disclose it for privacy reasons of my work), but as with most pop-up windows, you cannot even see the installed extensions. Is it possible for tampermonkey to detect / run scripts in pop-up windows like this, and if so, is anything special needed to do so? (I am mostly a python/java developer and am not particularly familiar with the DOM/front-end development beyond basics).
Asked
Active
Viewed 783 times
0
-
1Find the URL of the popup window and use it in the script's `@match`. To do it, right-click inside the window, choose "inspect", switch to console and run `location.href`. You can also use `chrome://inspect` page. – wOxxOm Jul 18 '22 at 20:16
1 Answers
0
As wOxxOm said in his comment: Yes, it can.
The most common problems can often be solved by wrapping your script in a setTimeout or using Brock's waitForKeyElements utility. Or, if you prefer, mutationObserver.
Links:
https://stackoverflow.com/a/11197969/1447509
https://stackoverflow.com/a/17872564/1447509

cssyphus
- 37,875
- 18
- 96
- 111
-
`IntersectionObserver` probably should be used instead of `setTimeout` in most cases – Konrad Jul 19 '22 at 14:53