tools/site_compare/site_compare.py
def Scrape(browsers, urls, window_size=(1024, 768),
           window_pos=(0, 0), timeout=20, save_path=None, **kwargs):
  """Invoke one or more browsers over one or more URLs, scraping renders.

  Args:
    browsers: browsers to invoke with optional version strings
    urls: URLs to visit
    window_size: size of the browser window to display
    window_pos: location of browser window
    timeout: time (in seconds) to wait for page to load
    save_path: root of save path, automatically appended with browser and
      version
    kwargs: miscellaneous keyword args, passed to scraper
  Returns:
    None

  @TODO(jhaas): more parameters, or perhaps an indefinite dictionary
  parameter, for things like length of time to wait for timeout, speed
  of mouse clicks, etc. Possibly on a per-browser, per-URL, or
  per-browser-per-URL basis
  """

  if type(browsers) in types.StringTypes: browsers = [browsers]

  if save_path is None:
    # default save path is "scrapes" off the current root
    save_path = os.path.join(os.path.split(__file__)[0], "Scrapes")

  for browser in browsers:
    # Browsers should be tuples of (browser, version)
    if type(browser) in types.StringTypes: browser = (browser, None)
    scraper = scrapers.GetScraper(browser)

    full_path = os.path.join(save_path, browser[0], scraper.version)
    drivers.windowing.PreparePath(full_path)

    scraper.Scrape(urls, full_path, window_size, window_pos, timeout, kwargs)
Invoke one or more browsers over one or more URLs, scraping renders.

  Args:
    browsers: browsers to invoke with optional version strings
    urls: URLs to visit
    window_size: size of the browser window to display
    window_pos: location of browser window
    timeout: time (in seconds) to wait for page to load
    save_path: root of save path, automatically appended with browser and
      version
    kwargs: miscellaneous keyword args, passed to scraper
  Returns:
    None

  @TODO(jhaas): more parameters, or perhaps an indefinite dictionary
  parameter, for things like length of time to wait for timeout, speed
  of mouse clicks, etc. Possibly on a per-browser, per-URL, or
  per-browser-per-URL basis
  
Invoke one or more browsers over one or more URLs, scraping renders.
Invoke one or more browsers over one or more URLs scraping renders .
def Scrape(browsers, urls, window_size=(1024, 768),
           window_pos=(0, 0), timeout=20, save_path=None, **kwargs):
  if type(browsers) in types.StringTypes: browsers = [browsers]
  if save_path is None:
    save_path = os.path.join(os.path.split(__file__)[0], "Scrapes")
  for browser in browsers:
    if type(browser) in types.StringTypes: browser = (browser, None)
    scraper = scrapers.GetScraper(browser)
    full_path = os.path.join(save_path, browser[0], scraper.version)
    drivers.windowing.PreparePath(full_path)
    scraper.Scrape(urls, full_path, window_size, window_pos, timeout, kwargs)
def Scrape ( browsers , urls , window_size = ( 1024 , 768 ) , window_pos = ( 0 , 0 ) , timeout = 20 , save_path = None , ** kwargs ) : if type ( browsers ) in types . StringTypes : browsers = [ browsers ] if save_path is None : save_path = os . path . join ( os . path . split ( __file__ ) [ 0 ] , "Scrapes" ) for browser in browsers : if type ( browser ) in types . StringTypes : browser = ( browser , None ) scraper = scrapers . GetScraper ( browser ) full_path = os . path . join ( save_path , browser [ 0 ] , scraper . version ) drivers . windowing . PreparePath ( full_path ) scraper . Scrape ( urls , full_path , window_size , window_pos , timeout , kwargs )
Invoke one or more browsers over one or more URLs, scraping renders.
Invoke one or more browsers over one or more URLs scraping renders .
"""Invoke one or more browsers over one or more URLs, scraping renders.

  Args:
    browsers: browsers to invoke with optional version strings
    urls: URLs to visit
    window_size: size of the browser window to display
    window_pos: location of browser window
    timeout: time (in seconds) to wait for page to load
    save_path: root of save path, automatically appended with browser and
      version
    kwargs: miscellaneous keyword args, passed to scraper
  Returns:
    None

  @TODO(jhaas): more parameters, or perhaps an indefinite dictionary
  parameter, for things like length of time to wait for timeout, speed
  of mouse clicks, etc. Possibly on a per-browser, per-URL, or
  per-browser-per-URL basis
  """ # default save path is "scrapes" off the current root # Browsers should be tuples of (browser, version)
None
browsers
browsers to invoke with optional version strings
browsers to invoke with optional version strings
urls
URLs to visit
URLs to visit
window_size
size of the browser window to display
size of the browser window to display
window_pos
location of browser window
location of browser window
timeout
time (in seconds) to wait for page to load
time ( in seconds ) to wait for page to load
save_path
root of save path, automatically appended with browser and
version
root of save path automatically appended with browser and version
kwargs
miscellaneous keyword args, passed to scraper
miscellaneous keyword args passed to scraper