Home | History | Annotate | Download | only in chrome
      1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """Does scraping for versions of Chrome up to 0.1.97.0."""
      6 
      7 from drivers import windowing
      8 
      9 import chromebase
     10 
     11 # Default version
     12 version = "0.1.97.0"
     13 
     14 
     15 def GetChromeRenderPane(wnd):
     16   return windowing.FindChildWindow(wnd, "Chrome_BrowserWindow")
     17 
     18 
     19 def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
     20   """Invoke a browser, send it to a series of URLs, and save its output.
     21 
     22   Args:
     23     urls: list of URLs to scrape
     24     outdir: directory to place output
     25     size: size of browser window to use
     26     pos: position of browser window
     27     timeout: amount of time to wait for page to load
     28     kwargs: miscellaneous keyword args
     29 
     30   Returns:
     31     None if succeeded, else an error code
     32   """
     33   chromebase.GetChromeRenderPane = GetChromeRenderPane
     34 
     35   return chromebase.Scrape(urls, outdir, size, pos, timeout, kwargs)
     36 
     37 
     38 def Time(urls, size, timeout, **kwargs):
     39   """Forwards the Time command to chromebase."""
     40   chromebase.GetChromeRenderPane = GetChromeRenderPane
     41 
     42   return chromebase.Time(urls, size, timeout, kwargs)
     43