Rayrun
← Back to Discord Forum

Anyone know how to handle how to handle location popup in playwright?

I want to test the functionality where user can either allow or deny the browser to access location...grantPemision doesn't sound like it fully does this? This is what I have tried but doesn't seem to work either: const popup = page.locator('button:has-text("allow")'); if (await popup.isVisible()) { await popup.click(); } else { console.log('No location popup found.'); }

// await page.getByLabel('Address', { exact: true }).click(); await page.getByLabel('Address', { exact: true }).fill('oak'); await popup.click();

This thread is trying to answer question "How to handle location popup in Playwright?"

2 replies
refactoreric

Hi, I believe Playwright suppresses location permission popups. It's browser functionality, not app functionality, and such popups are in the way of reliable automation.

I suppose you want to use geolocation in your tests? There's some documentation here about it: https://playwright.dev/docs/emulation#geolocation

It shows how to configure playwright to grant permissions for location for all tests, for a project, or a single test.

tphillips8117
@hlulani.: Yeah looking or that popup sounds like you're testing the browser, not the web application/web page.

Yeah looking or that popup sounds like you're testing the browser, not the web application/web page.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].