Headless Google Chrome - Change Time Zone

Is it possible to run mute Google Chrome and programmatically set the timezone for testing? It doesn't seem to be present as a shell switch .

I would like to be able to run tests with different timezones to confirm that the front end is handling the timezone change correctly.

+3


source to share


1 answer


I recently came across this script that solves this problem. It supports multiple configuration options. From the code:

# Change this to the spoof a different timezone. Helpful for testing timezone specific client facing content.
export TZ="America/Los_Angeles"

# Permanent directory to store the user-data directory of your 'fresh'
# Chrome configuration.
fresh_dir="$HOME/.fresh-chrome"

# Temporary directory in which to create new user-data directories for
# temporary Chrome instances.
tmp_dir="/tmp"

      



Interestingly, the variable is TZ

not part of the script. Perhaps Chrome is reading the environment variable TZ

when it starts? I'm not sure, but it works now.

+2


source







All Articles