modify script for use with chrome and dartium

@ussuri 
It would be nice to wrap into a function these 4 blocks with duplicate statements for Chrome and Chromium.