'activate 2 Edge windows with powershell

I'm trying to write a simple script which automatically cycles tabs on 2 different edge windows, I have it working on one window in the code below

while(1 -eq 1){
    $wshell=New-Object -ComObject wscript.shell;
    $wshell.AppActivate('Edge'); # Activate on Edge browser
    Sleep 5; # Interval (in seconds) between switch 
    $wshell.SendKeys('^{PGUP}'); # Ctrl + Page Up keyboard shortcut to switch tab
}

How could I activate the second Edge window?

I have already tried alt-tab ing to the other one with this $wshell.SendKeys('%{TAB}'); but it didnt seem to work



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source