title: Make headless browser stop loading page
body: <p>I am using the watir-webdriver ruby gem. It starts the browser (Chrome) and begins to load a page. The page is loading too slowly, and watir-webdriver raises a timeout error. How can I make the browser stop loading the page?</p>
  
  <pre><code>require 'watir-webdriver'
  
  client = Selenium::WebDriver::Remote::Http::Default.new
  client.timeout = 10
  @browser = Watir::Browser.new :chrome, :http_client =&gt; client
  
  sites = [
    "http://google.com/",
    "http://yahoo.com/",
    "http://www.nst.com.my/", # =&gt; This is the SLOW site
    "http://drupal.org/",
    "http://www.msn.com/",
    "http://stackoverflow.com/"
  ]
  
  sites.each do |url|
  
    begin
      @browser.goto(url)
      puts "Success #{url}"
    rescue
      puts "Timeout #{url}"
    end
  
  end
  
  ########## Execution result ########## 
  
  # Success http://google.com/
  # Success http://yahoo.com/
  # Timeout http://www.nst.com.my/
  # Timeout http://drupal.org/
  # Timeout http://www.msn.com/
  # Timeout http://stackoverflow.com/
  
  ########## Expected result ########## 
  
  # Success http://google.com/
  # Success http://yahoo.com/
  # Timeout http://www.nst.com.my/
  # Success http://drupal.org/
  # Success http://www.msn.com/
  # Success http://stackoverflow.com/
  </code></pre>
  
  <p>It looks like the browser doesn't respond to any other commands before it finishes loading the page. How can I force the browser to throw away the page it is loading and execute the next command?</p>
  
  <p>UPDATED</p>
  
  <p>I have found an interesting capability flag loadAsync <a href="http://src.chromium.org/svn/trunk/src/chrome/test/webdriver/webdriver_capabilities_parser.cc" rel="nofollow">http://src.chromium.org/svn/trunk/src/chrome/test/webdriver/webdriver_capabilities_parser.cc</a> Maybe it can be useful for solving this problem? I don't understand yet how to make watir (webdriver) to set this when starting the chromedriver. This flag was introduced here <a href="http://codereview.chromium.org/7582005/" rel="nofollow">http://codereview.chromium.org/7582005/</a></p>