title: Selenium:How to return to the previous page after accept the alert popup？
body: <p>I use selenium (python) for the test page.
  The test process is: </p>
  
  <ol>
  <li><p>Initially, I have a page A, and the second page B pops up by clicking a link on page A. </p></li>
  <li><p>When I submitted the form on page B, an alert popup came out (only the OK button). </p></li>
  <li><p>When the pop-up window is accepted, page B is automatically closed. At this time, there is only page A in the browser, and I can see it. </p></li>
  </ol>
  
  <p>The question is, after page B closed, how do I get control of page A? </p>
  
  <p>My code is roughly as follows：</p>
  
  <p>A_handle = dr.current_window_handle #Initially operate on page A</p>
  
  <p>...After accepting the popup on page B...</p>
  
  <p><strong>dr.switch_to_window(A_handle) #This line gives an error---no such window: target window already closed</strong></p>
  
  <p>I am very confused, does anyone have a solution？</p>