title: How to switch between Chrome windows in Powershell?
body: <p>I am writing a powershell script that goes through 3 chrome windows (<strong>not tabs</strong>, these windows are on 3 different monitors) and want to refresh every window.
  I cannot figure out a way to switch between windows.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>while(1) { # Loop forever
    sleep -Seconds 15 # Wait 15sec
    $wshell = New-Object -ComObject wscript.shell 
    if($wshell.AppActivate('Chrome')) { # Switch to Chrome
     Sleep 1 # Wait for Chrome to "activate"
     $wshell.SendKeys('{F5}')  # Send F5 (Refresh)
  } else { break; } # Chrome not open, exit the loop
  }
  </code></pre>
  
  <p>This only refreshes one page. I tried to use </p>
  
  <pre><code> [System.Windows.Forms.SendKeys]::SendWait("%+{ESC}") 
  </code></pre>
  
  <p>to switch between apps, but since there are other open apps it is not possible.</p>
  
  <p>Is there a way to switch between Chrome windows? Haven't found any shortcuts or solutions.</p>
  
  <p>Thank you!</p>