Allow Web Automation Tests to Use Your Location

How to get around Chrome’s Location Permissions Pop-Up

Courtney Zhan
2 min readNov 16, 2024

An increasing number of web apps are being used on smartphones, and some of these apps include location-aware features.

However, recently Chrome blocks location-awareness by default and instead has a popup that prompts you to allow location tracking. You’ve probably seen this when you’re browsing online on your own.

When this happens, your automated test execution most likely will fail.

Method 1. Manually Click Allow (Not Recommended)

The simplest way to get around this is manual intervention, such as pausing the test execution and manually clicking the allow button. However, this is a bad idea.

sleep 10
# during the time, manually click the "Allow" button
# continue

Instead, I recommend changing the test machine’s settings to always allow locations to prevent this popup in the future from interfering with tests.

Method 2. Allow

Open macOS System Settings, search for “location”, and then Select “Allow applications to access your location” and toggle “Google Chrome” to on.

Then in Chrome, navigate to the target site. Click the filter icon on the left of the web address bar, and then click “Site settings”.

This will open the settings in a new tab that shows site permissions.

Under ‘Permissions” -> “Location”, set the value to “Allow”.

Quit the browser.

Run the test again, this time, locations should be enabled and the test should use locations just fine!

--

--