2014-07-01 20:37:17 +04:00
|
|
|
from automation import TaskManager
|
|
|
|
|
|
|
|
# The list of sites that we wish to crawl
|
|
|
|
NUM_BROWSERS = 3
|
|
|
|
sites = ['http://www.example.com',
|
|
|
|
'http://www.princeton.edu',
|
|
|
|
'https://citp.princeton.edu/']
|
|
|
|
|
2015-09-14 18:05:50 +03:00
|
|
|
# Loads the manager preference and 3 copies of the default browser dictionaries
|
|
|
|
manager_params, browser_params = TaskManager.load_default_params(NUM_BROWSERS)
|
2014-07-01 20:37:17 +04:00
|
|
|
|
2015-09-14 18:05:50 +03:00
|
|
|
# Update browser configuration (use this for per-browser settings)
|
2014-07-01 20:37:17 +04:00
|
|
|
for i in xrange(NUM_BROWSERS):
|
2015-09-14 18:05:50 +03:00
|
|
|
browser_params[i]['disable_flash'] = False #disable flash for all three
|
|
|
|
browser_params[0]['headless'] = True #Launch only browser 0 headless
|
2014-07-01 20:37:17 +04:00
|
|
|
|
2015-09-14 18:05:50 +03:00
|
|
|
# Update TaskManager configuration (use this for crawl-wide settings)
|
|
|
|
manager_params['data_directory'] = '~/Desktop/'
|
|
|
|
manager_params['log_directory'] = '~/Desktop/'
|
2014-07-01 20:37:17 +04:00
|
|
|
|
|
|
|
# Instantiates the measurement platform
|
|
|
|
# Commands time out by default after 60 seconds
|
2015-09-14 18:05:50 +03:00
|
|
|
manager = TaskManager.TaskManager(manager_params, browser_params)
|
2014-07-01 20:37:17 +04:00
|
|
|
|
|
|
|
# Visits the sites with both browsers simultaneously, 5 seconds between visits
|
|
|
|
for site in sites:
|
|
|
|
manager.get(site, index='**') # ** = synchronized browsers
|
|
|
|
|
|
|
|
# Shuts down the browsers and waits for the data to finish logging
|
|
|
|
manager.close()
|