From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Localization and geolocation in Playwright

Localization and geolocation in Playwright

- [Instructor] While our practice site doesn't have any automatic geolocation or localization changes, many modern web apps will respond differently based on location or time zone of the browser. Let's take a look at geolocation first to get an understanding of what Playwright is doing. To do this, let's go ahead and open up a Chrome window in incognito mode and we are going to right click and click inspect. This is the Chrome dev tools. We are going to find the three dots over here on the right hand side. Click this button. We are going to click more tools and we're going to scroll down to sensors and click this. So this is going to add a new sensor area and what this allows you to do is set your location. There are a bunch of presets in here, so let's just choose Tokyo and let's go ahead and just go to bing.com. As you can see, the site is rendering in Japanese. This is because of the location that we set here. If we change this to Berlin, potentially that will change. So we're not…

Contents