Custom locale or timezone

Mobitru supports a browser session’s custom locale or timezone if it’s necessary to override the default values – en:en and GMT+0.
The custom timezone feature is available for all browsers except Safari.
The custom locale is available for all browsers except Safari and Opera.

Enable in tests

To start using the custom locale or timezone, it’s necessary to add the env option with an array as a value.
The array should contain appropriate item(s) with timezone or locale identifiers:

  • Timezone: ‘TZ’ as keyword and appropriate identifier as value, for example TZ=Europe/Istanbul
  • Locale: ‘LC_ALL’ as keyword and appropriate identifier as value, for example LC_ALL=de_AT.UTF-8

Also, this option should be located inside the mobitru:options map.
Below you can find an example for different programming languages:

public void startDriver() {
        ChromeOptions chromeOptions = new ChromeOptions();
        Map<String, Object> moonOptions = new HashMap<>();
        moonOptions.put("env", Arrays.asList("TZ=Europe/Istanbul", "LC_ALL=de_AT.UTF-8"));
        chromeOptions.setCapability("mobitru:options", moonOptions);
        RemoteWebDriver driver = new RemoteWebDriver(new URL("https://" + BILLING_UNIT+":" + ACCESS_TOKEN + "@browserhub-us.mobitru.com/wd/hub"), chromeOptions);
    }
def start_driver():
    options = webdriver.ChromeOptions()
    mobitru_options = {
        'env': ['TZ=Europe/Istanbul','LC_ALL=de_AT.UTF-8']
    }
    options.set_capability('mobitru:options', mobitru_options)
    cloud_url = f"https://{BILLING_UNIT}:{ACCESS_TOKEN}@browserhub-us.mobitru.com/wd/hub"
    return webdriver.Remote(cloud_url, options=options)
it('browser session init', async function () {
    const mobitruOptions = {
      'mobitru:options': {
        'env': ['TZ=Europe/Istanbul','LC_ALL=de_AT.UTF-8']
      }
    }
    let driver = new Builder()
        .withCapabilities(mobitruOptions)
        .forBrowser(Browser.CHROME)
        .usingServer(`https://${BILLING_UNIT}:${ACCESS_TOKEN}@browserhub-us.mobitru.com/wd/hub`)
        .build()
});

Scroll to Top