Skip to main content
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Test from a specific location

Run web sessions from the IP address of a country or region you name to check geo-blocking, local currency, and translated pages.

Some behavior only appears when the request comes from a particular country: a geo-block, a price in local currency, a translated page, a regional redirect. Testing from your own network does not show you any of it.

Name a country or region in your prompt. Test Companion opens the browser through BrowserStack IP Geolocation, so the site under test sees traffic from that place.

IP Geolocation in Test Companion is available on request. Contact us to have it enabled for your account.

Prerequisites

  • Test Companion version 1.26.0 or later on Visual Studio Code, or version 1.6.0 or later on a JetBrains IDE. Earlier versions of Test Companion do not offer geolocation.
  • A site reachable from the public internet. Test Companion opens the page in a browser that runs in the BrowserStack cloud.
  • The IP Geolocation add-on enabled on your BrowserStack account, to run the generated script yourself. You do not need the add-on to write the test, because Test Companion runs that session on BrowserStack’s own account.

IP Geolocation does not work with a site on localhost or on your intranet. Test Companion reaches a local site through a tunnel back to your own machine, so the site sees requests from your own network rather than from the country you named. Deploy the site to a public URL first.

How it works

  1. You name a country or region in your prompt.
  2. Test Companion matches the name to a BrowserStack location code.
  3. Test Companion opens a Chrome browser in the BrowserStack cloud that connects from that location.
  4. Test Companion controls the cloud browser from your IDE: it navigates pages, fills forms, and reads results.
  5. When Test Companion writes the runnable script, it saves the location in your project’s configuration file.

Start a session from a location

Name the country or region in your prompt. There is no setting to turn on and nothing to configure by hand.

Open https://example.com from Germany and tell me whether the pricing is shown in euros.

You can also name a state or province. Test Companion uses that narrower location when BrowserStack supports one, instead of the whole country.

Test Companion resolves the name you give in one of three ways.

Location name Behavior
A supported country, state, or province Test Companion starts the session from that location and names it in the chat.
A name that matches more than one place Test Companion asks you to confirm the place before it starts the session.
A place BrowserStack does not support Test Companion names the locations it does support, then retries with one of them. Your task continues.

For every place you can name, see the list of countries and the list of states.

Confirm the location was applied

Test Companion names the location it used when the session starts. Read that line before you draw any conclusion from the page, because currency and copy mean nothing until you know where the request came from.

When Test Companion cannot apply the location, it says the session ran without it. It does not claim the session came from your chosen country. It does not attribute localized copy, currency, or a redirect to the location.

Two things cause this message most often:

  • IP Geolocation is not enabled for your BrowserStack account yet.
  • Test Companion could not reach the cloud browser, so it fell back to a browser on your machine.

Treat the message as a prompt to check your account, not as a test result.

Save the location in your test script

Test Companion adds the geoLocation capability to the configuration file your project already uses, so your own runs start from the same place. The location code is short: DE for Germany, DE-BY for Bavaria.

In browserstack.yml:

bstack:options:
  geoLocation: DE

In wdio.conf.js or another WebdriverIO configuration:

'bstack:options': {
  geoLocation: 'DE',
}

Review the change in the editor diff view before you accept it.

Known limitations

  • Network location only. The location changes the address your traffic appears to come from. It does not set GPS coordinates. It does not change what the browser reports when a page asks the visitor for their location. A map or a “near me” feature behaves as it always does.
  • One session at a time. Starting a new geolocation session closes the previous one. To compare two countries, run them one after the other.

Best practices

  • Name the location in the prompt itself. Test Companion then starts the session without stopping to ask you.
  • Read the reported location first. Currency, copy, and redirects only tell you something after you know where the request came from.
  • Point the session at a deployed URL. A site on localhost or your intranet cannot be reached from the country you name.

Example prompts

Check a geo-block and write the test for it:

Check whether https://example.com/watch is blocked from Germany.
Then write a Playwright test that asserts the block message.

Compare localized pricing across two countries:

Open the pricing page on https://example.com from the United States and
then from Germany, and tell me whether the currency and the amounts differ.

Check behavior that varies by state:

Test the checkout page on https://example.com from Bavaria and confirm the
correct VAT rate is applied.

Next steps

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle