Code Monkey home page Code Monkey logo

Comments (4)

DanielStoica85 avatar DanielStoica85 commented on June 2, 2024

Update 1

I also added this to check what the detected locale is and the result was indeed de-DE, but somehow the redirect still does not happen accordingly.

// Execute JavaScript in the browser context to get the detected locale
  const detectedLocale = await page.evaluate(() => {
    // Access the browser's navigator object to get the language
    return navigator.language;
  });

  console.log('Detected Locale:', detectedLocale);

image

Update 2

Also checked the request headers and the Accept-Language is indeed de-DE, but then in the response headers I also see this:

image

Update 3: tried this on other websites as well and I always get redirected based on my real location and not based on the one set by Playwright

from playwright.

yury-s avatar yury-s commented on June 2, 2024

They may be redirecting you based on your IP address or some other logic. The adidas url does redirect me to 'https://www.adidas.com/us'. If you think that Playwright is not changing some settings properly based on locale, please provide a self contained reproduction which we could run locally.

from playwright.

DanielStoica85 avatar DanielStoica85 commented on June 2, 2024

If that is the case (it most likely is), is there another (better) way to emulate a location by using Playwright, so that we can verify that the redirect happens as expected based on location?

from playwright.

mxschmitt avatar mxschmitt commented on June 2, 2024

IP address based geolocation detection can only be emulated on the networking level, so e.g. a proxy might work for you.

Closing since thats not a bug in Playwright.

from playwright.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.