How to set the correct timezone of Chrome in TestOps?

We have a Katalon test which tests the Date selected by the user and checks if the date is stored correctly. The web application used is written in React 19. When selecting the date, a Javascript Date object is used to show the selected date, but when stored in the database, a string representation of the Date object is shown.

When selecting the date, the time is 11:00 o’clock, but when displaying the stored date, the tine is 9:00 o’clock. We are running the application in The Netherlands (UTC + 1 using daylight saving time). We have configured Katalon TestOps to use this timezone and geoLocation NL like so: Desired Capabilities → TestOps:

{

  "TESTCLOUD_DRIVER": {
    "katalon:options": {
       "timezone": "UTC+01:00",
       "region": "eu-west-1",
       "geoLocation": "NL"
    }
  }
}

It is still not working. Anyone has any idea how to fix this?

2 Likes

hey @maurits.lourens

I think the TestOps timezone setting doesn’t actually affect the Chrome browser that launches during tests. it seems you need to pass the timezone directly to Chrome. try to add this to your test setup:

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 if you’re using Desired Capabilities:

goog:chromeOptions = {
  "env": {
    "TZ": "Europe/Amsterdam"
  }
}

Chrome defaults to the system timezone (probably UTC), which is why you’re seeing that 2-hour difference. I think this should force it to use the correct timezone

1 Like

1. Confirm TestCloud Environment Timezone

  • Ensure the underlying machine (not just browser capabilities) is set to UTC+01:00 before test execution.
  • Katalon’s "timezone" dictionary should look like:
{
  "TESTCLOUD_DRIVER": {
    "katalon:options": {
      "timezone": "Europe/Amsterdam"
    }
  }
}
  • Some sources suggest using Olson names (e.g. "Europe/Amsterdam") instead of "UTC+01:00", as this is more widely supported in browser/Selenium settings.

2. Use Chrome DevTools API to Set Timezone

  • Directly apply a timezone override using Chrome DevTools Protocol (CDP):
import org.openqa.selenium.chrome.ChromeDriver

Map<String, Object> params = new HashMap<>()
params.put("timezoneId", "Europe/Amsterdam")
((ChromeDriver) DriverFactory.getWebDriver()).executeCdpCommand("Emulation.setTimezoneOverride", params)
  • Place this code after browser is launched, before interacting with the web app.
  • This sets the timezone for all JS Date operations (what Intl.DateTimeFormat().resolvedOptions().timeZone and new Date() will see).​
1 Like

I tried both the Desired Capabilities and the ChromeDriver approach, but neither seems to have the desired effect. Locally my tests succeed (because it is run in the right timezone), but on TestOps they always fail. When I try to change the timezone in my Chrome sensors, I see the same behavior as in TestOps, so it should work by setting the timezone.

When trying to set the experimentalOption, I get this error message: “unrecognized chrome option: env” and when trying to set the timezoneOverride, I get this error message in TestOps: “No signature of method: org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$POaKSCv5.executeCdpCommand() is applicable for argument types: (String, HashMap) values: [Emulation.setTimezoneOverride, [timezoneId:Europe/Amsterdam]]

1 Like

share your code and settings configured at your end?

This is how I open the browser before starting my test:

'Open de browser'
WebUI.openBrowser(GlobalVariable.URL['applicatie'])

'Set viewport size 703x347'
WebUI.setViewPortSize(703, 347)

'Webdriver fixen'
WebDriver driver = DriverFactory.getWebDriver()

'Zet de timezone in DevTools'
Map<String, Object> params = new HashMap<>()
params.put("timezoneId", "Europe/Amsterdam")
driver.executeCdpCommand("Emulation.setTimezoneOverride", params)
/*ChromeOptions options = new ChromeOptions()
Map<String, String> env = new HashMap<>()
env.put("TZ", "Europe/Amsterdam")
options.setExperimentalOption("env", env)
WebDriver newDriver = new ChromeDriver(options)
DriverFactory.changeWebDriver(newDriver)*/

'Monitor kiezen (voor demo doeleinden)'
driver.manage().window().setPosition(new Point(GlobalVariable.SchermPositie['x'], GlobalVariable.SchermPositie['y']))

WebUI.maximizeWindow()

WebUI.takeScreenshot()

These are my TestCloud project settings:

This is my test case:

WebUI.click(findTestObject('Clientportaal/BK/div_EenAfspraakMaken'))

WebUI.waitForPageLoad(GlobalVariable.TimeOut['normaal'])

WebUI.click(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/div_eersteAfspraakResultaat'))

String datumAfspraak = WebUI.getText(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/span_DatumWaarde'))

String tijdAfspraak = WebUI.getText(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/span_TijdWaarde'))

//Dit is nodig tot dat er in clientportaal de juiste tijden worden getoond bij afpsraak zoeken, nu toont die 2 uur eerder dan daadwerkelijke afspraak moment
if (System.getenv().containsKey('TESTOPS_SESSION_ID')) {
    tijdAfspraak = CustomKeywords.'screening.Universeel.pasTijdAan'(tijdAfspraak, 2, 0)
}

String straatnaamAfspraak = WebUI.getText(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/span_StraatnaamWaarde'))

WebUI.click(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/button_afspraakBevestigen'))

WebUI.waitForElementPresent(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/label_emailadres'), 
    GlobalVariable.TimeOut['kort'])

WebUI.setText(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/input_Emailadres'), lv_email)

WebUI.click(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/button_bevestigingEmail'))

if (WebUI.verifyElementPresent(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/a_GeenSms'), 
    2, FailureHandling.OPTIONAL)) {
    WebUI.click(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/a_GeenSms'))
}

WebUI.click(findTestObject('Clientportaal/BK/Afspraak maken-verzetten/Afspraak bevestigen/a_slaOver'))

WebUI.waitForPageLoad(GlobalVariable.TimeOut['kort'])

String getoondeDatumTijd = WebUI.getText(findTestObject('Clientportaal/BK/span_AfspraakDatumTijd'))

String getoondeLocatie = WebUI.getText(findTestObject('Clientportaal/BK/span_AfspraakAdresLocatie'))

String afspraakDatumZonderJaar = datumAfspraak.substring(0, datumAfspraak.lastIndexOf(' '))

assert getoondeDatumTijd.contains(afspraakDatumZonderJaar)

assert getoondeDatumTijd.contains(tijdAfspraak)

assert getoondeLocatie.contains(straatnaamAfspraak)

return [('afspraakDatum') : datumAfspraak, ('afspraakTijd') : tijdAfspraak, ('afspraakLocatie') : straatnaamAfspraak]

The issue is with getoondeDatumTijd, which is 11:00 o’clock when stored in the variable tijdAfspraak but 9 o’clock when displayed in the UI.

This is how it looks like in the UI:

Which looks like this in React:

<SearchResultAfspraken
							key={index}
							className={styles.result}

							col1={["", placeNonBreakingSpaceInDate(formatDateWithDayName(afspraakOptie.datumTijd)), `${formatTime(afspraakOptie.datumTijd)} uur`]}
							col3={["Locatie", afspraakOptie.adres, `${afspraakOptie.postcode} ${afspraakOptie.plaats}`]}

							onHoverText={getString(properties.searchresult.hovertext)}
							onClickAction={() => afspraakGekozen(afspraakOptie)}
						/>,

formatTimeis a function from the date-fns node module.

The asserted date looks like this in the UI:

This string is parsed by Java like this:

var huidigeAfspraakDto = new MammaHuidigeAfspraakDto();
final Locale LOCALE_NL = Locale.forLanguageTag("NL-nl")
final DateTimeFormatter LOCAL_DATE_TIME_WEERGAVE_CLIENTPORTAAL_FORMAT_INCL_DAG = DateTimeFormatter.ofPattern("EEEE d MMMM HH:mm", LOCALE_NL);
var datum = DateUtil.toLocalDateTime(huidigeAfspraak.getVanaf());
var weergaveDatum = datum.format(LOCAL_DATE_TIME_WEERGAVE_CLIENTPORTAAL_FORMAT_INCL_DAG);	huidigeAfspraakDto.setWeergaveAfspraakMoment(StringUtils.capitalize(weergaveDatum));

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.

Hi @maurits.lourens ,

Have you been able to solve your issue? If yes, please share your solution with others? If no, please let us know more information so that we can better support. Thank you

1 Like

What I said in this comment is still the case, neither option is working for me and throwing errors. What else can I try?

Hi @maurits.lourens,
Thanks for the update! Since both options are still throwing errors, the best next step is to submit a support ticket so our team can review your logs and environment in detail.

Please open a ticket here:
:backhand_index_pointing_right: https://katalon-inc.my.site.com/support/

They’ll be able to provide direct technical assistance. Let me know if you need help with anything else!

Thanks for your help, I have created a support ticket for this. Once a solution has been found, I will update this thread.

3 Likes

The fix was to set the Desired Capabilities to

{
  “katalon:options”: {
    “timezone”: “UTC-01:00”
  }
}
1 Like