Skip to main content

Set geographic location

TestCloud supports setting geographic location for mobile and web testing.

In some test scenarios, you may want to dynamically set geographic location (or geolocation) to:
  • Ensure the website and mobile app display correctly when accessed from different geolocations.

  • Verify that localization features such as language translation, currency change, and time zone changes reflect accurately according to different locations.

  • Confirm that blocked or restricted content like images, content, or videos are blocked as intended from different locations.

There are two ways to set geolocation while executing tests with TestCloud:

  • You can simulate geolocation at the start of testing sessions using the desired capability geoLocation. Open your project in Katalon Studio and go to Project Settings > Desired Capabilities > Remote. Add the String property geoLocation=<country-code>
    geoLocation desired capabilities
  • Use the GeolocationExecutor class with the setMobileGeoLocation method in TestCloud. The keyword class should be created and declared under the com.katalon.testcloud package.
    package com.katalon.testcloud
    import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
    import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
    import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
    import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
    import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
    import com.kms.katalon.core.annotation.Keyword
    import com.kms.katalon.core.checkpoint.Checkpoint
    import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
    import as Mobile
    import com.kms.katalon.core.model.FailureHandling
    import com.kms.katalon.core.testcase.TestCase
    import com.kms.katalon.core.testdata.TestData
    import com.kms.katalon.core.testobject.TestObject
    import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
    import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
    import as Windows
    import com.kms.katalon.core.configuration.RunConfiguration
    import io.appium.java_client.AppiumDriver;
    import internal.GlobalVariable;
    import org.openqa.selenium.html5.Location

    public class GeolocationExecutor {
    * Set GPS geolocation for the mobile device.
    * @param latitude the latitude of the location
    * @param longitude the longitude of the location
    * @param altitude the altitude of the location
    void setMobileGeoLocation(double latitude, double longitude, double altitude) {