chrome/test/enterprise/e2e/infra/test_util.py
def shutdown_chrome():
  """Shutdown Chrome cleanly.

    Surprisingly there is no easy way in chromedriver to shutdown Chrome
    cleanly on Windows. So we have to use win32 API to do that: we find
    the chrome window first, then send WM_CLOSE message to it.
  """
  window_list = _get_chrome_windows()
  if not window_list:
    raise RuntimeError("Cannot find chrome windows")

  for win in window_list:
    win32gui.SendMessage(win, win32con.WM_CLOSE, 0, 0)

  # wait a little bit for chrome processes to end.
  # TODO: the right way is to wait until there are no chrome.exe processes.
  time.sleep(2)
Shutdown Chrome cleanly.

    Surprisingly there is no easy way in chromedriver to shutdown Chrome
    cleanly on Windows. So we have to use win32 API to do that: we find
    the chrome window first, then send WM_CLOSE message to it.
  
Shutdown Chrome cleanly.
Surprisingly there is no easy way in chromedriver to shutdown Chrome
cleanly on Windows. So we have to use win32 API to do that: we find
the chrome window first, then send WM_CLOSE message to it.
Shutdown Chrome cleanly . Surprisingly there is no easy way in chromedriver to shutdown Chrome cleanly on Windows . So we have to use win32 API to do that : we find the chrome window first then send WM_CLOSE message to it .
def shutdown_chrome():
  window_list = _get_chrome_windows()
  if not window_list:
    raise RuntimeError("Cannot find chrome windows")
  for win in window_list:
    win32gui.SendMessage(win, win32con.WM_CLOSE, 0, 0)
  time.sleep(2)
def shutdown_chrome ( ) : window_list = _get_chrome_windows ( ) if not window_list : raise RuntimeError ( "Cannot find chrome windows" ) for win in window_list : win32gui . SendMessage ( win , win32con . WM_CLOSE , 0 , 0 ) time . sleep ( 2 )
Shutdown Chrome cleanly.
Shutdown Chrome cleanly .
"""Shutdown Chrome cleanly.

    Surprisingly there is no easy way in chromedriver to shutdown Chrome
    cleanly on Windows. So we have to use win32 API to do that: we find
    the chrome window first, then send WM_CLOSE message to it.
  """ # wait a little bit for chrome processes to end. # TODO: the right way is to wait until there are no chrome.exe processes.