title: Open Chrome from command line and wait till it's closed
body: <p>I'm using following code to iterate over a list of browsers executable paths and start each of them:</p>
  
  <pre><code>foreach (var browser in browsers)
  {
      var proc = new Process();
      proc.StartInfo.FileName = browser.ExecutablePath;
      proc.StartInfo.Arguments = "http://google.com";
      proc.Start();
      proc.WaitForExit();
      Console.WriteLine(proc.ExitCode.ToString());
      proc.Close();
  }
  </code></pre>
  
  <p>What is should do is: it should open browser window with <em>google.com</em> loaded and stop the application until the window is closed. And it works fine for both IE and Firefox, but fails with Chrome.</p>
  
  <p>For Chrome <code>proc</code> is in <code>Exit</code> state just after launching the browser, when the window is still active and visible. </p>
  
  <p>I tried using some of <a href="http://peter.sh/experiments/chromium-command-line-switches/">chromium command line switches</a>, including <code>--new-window</code> and <code>--single-process</code> but with no success.</p>
  
  <p>Question is, how can I force Google Chrome to run in the process it is started in, so it would be possible to wait until window is closed?</p>
  
  <p><em><strong>Update</em></strong></p>
  
  <p>Just to clarify the question:</p>
  
  <ul>
  <li>I know why it does not work - it's because Chrome uses multiple processes for different things, like different tabs, plug-ins, etc. </li>
  <li>I tried to find the correct process looking on process tree, but found nothing.</li>
  <li>I can't just take the latest process created by chrome, because it may be the process created for a pluging the page requires, not the page itself.</li>
  </ul>