8

是否可以启动无头谷歌浏览器并以编程方式设置时区进行测试?它似乎没有作为shell switch存在。

我希望能够运行具有不同时区的测试,以确认前端正在正确处理时区转换。

4

1 回答 1

4

我最近遇到了解决此问题的脚本。它支持一些配置选项。从代码:

# 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"

有趣的是,该TZ变量不是脚本的一部分。也许 Chrome 在启动时会读取TZ环境变量?我不确定,但这暂时有效。

于 2017-08-08T20:40:46.090 回答