Use Olson Timezone Name (“Europe/Amsterdam”)
- Instead of using
"UTC+01:00", set"Europe/Amsterdam"as the timezone value in your options and environment map. - Example (DesiredCapabilities JSON):
{
"TESTCLOUD_DRIVER": {
"katalon:options": {
"timezone": "Europe/Amsterdam"
}
}
}
- Note: This alone might not override Chrome’s JS Date timezone for all environments.
2. Pass Timezone in ChromeOptions as Environment Variable
- Add an environment variable directly to Chrome’s execution environment (works in many Selenium/Cloud/CI platforms):
ChromeOptions options = new ChromeOptions()
Map<String, String> env = new HashMap<>()
env.put("TZ", "Europe/Amsterdam")
options.setExperimentalOption("env", env)
WebDriver driver = new ChromeDriver(options)
DriverFactory.changeWebDriver(driver)
Or Desired Capabilities:
"goog:chromeOptions": {
"env": {
"TZ": "Europe/Amsterdam"
}
}
3. Use Chrome DevTools CDP to Force Timezone Override
- Most reliable: execute CDP command to force timezone immediately after launching Chrome:
import org.openqa.selenium.chrome.ChromeDriver
Map<String, Object> params = new HashMap<>()
params.put("timezoneId", "Europe/Amsterdam")
((ChromeDriver) DriverFactory.getWebDriver()).executeCdpCommand("Emulation.setTimezoneOverride", params)
- This ensures all JS Date operations,
Intl.DateTimeFormat(), etc., use the intended timezone—regardless of underlying VM or Chrome defaults.