I can't log in to Shopify using the Playwright browser for automation testing

I am currently attempting to automate the login process for Shopify using Playwright (Python). However, I am unable to successfully log in when using the browser instance provided by Playwright.

The login process works normally when performed manually on a regular browser (e.g., Chrome), but fails when executed through Playwright automation.

Hey @Anh_Doan_Th_H_ng - thanks for reaching out.

Shopify’s login flows include bot detection which could potentially block automated browsers like Playwright from authenticating successfully. That might be what you’re running into here.

That said, automated browser testing against Shopify’s login isn’t something we officially support or provide tooling for. Depending on what you’re trying to test though, there might be better approaches available. If you’re testing storefront changes, we have built-in
simulation tooling (SimGym) in the Online Store Editor that lets you test against simulated buyer behavior. For app testing, Shopify CLI handles auth for you with shopify app dev.

Could you share a bit more about what exactly you’re trying to test and what login flow you’re hitting? That would help me point you in the right direction.

Hope to hear from you soon!

I’m having the same issue. I’m trying to automate my product imports and blocking Playwright has been a real pain to try to deal with. Is there some silver bullet to get around this so Playwright can do what it needs to?

It’d be really cool of Shopify to give us a way to still use Playwright. Maybe create an exception so you can still vet the use of Playwright, but allow us to create our automation as needed. This restriction is super frustrating. I have 1,000 other things I need to do to keep my store open rather than babysit a script to do my imports because Shopify is blocking Playwright for whatever reason.

Hey @TRDale -

Thanks for flagging this. Just to set expectations up front, we don’t block Playwright per se on our end here, so it’s not that automation tools are off-limits outright. What you’re likely running into is our generic bot detection (things like hCaptcha challenges, IP/ASN checks, throttling on the login flow), which can fire when automated browser signals line up with patterns we see from abuse traffic. Playwright, Puppeteer, Selenium, none of them are blocked by name, but they can all end up tripping the same signals depending on the setup, which isn’t super ideal when you’re just trying to test your own stuff.

Before I point you in a direction though, just want to understand the use case a bit better so I can point you somewhere useful. Are you trying to simulate real merchant flows to E2E test your embedded app? If that’s the case, the supported starting point on our end is the @shopify/app-bridge-testing-library on npm, which is built specifically for mocking App Bridge in tests. We also have an open issue tracking the broader E2E-with-Playwright gap over at shopify-app-bridge#527, so the friction you’re running into is something the team is aware of. Outside of that, a community developer built a tool called MockBridge that a few folks in the forum have had good results with, just flagging that it isn’t maintained or officially supported by Shopify, so use at your own discretion if you go that route.

If instead you’re looking to automate things like product imports, bulk updates, or order management, the Admin API (GraphQL) is going to be way more reliable than driving the UI, and I’d be happy to point you to the right docs once I know what you’re trying to move.

Let me know what you’re working on and I’ll see what I can suggest on our end here.

Well, I have figured out a work around for my situation. So, I’m good at this point. But for others, this is helpful information.

Thanks for the reply. I appreciate it and the information you’ve provided.

Could this potentially help? https://help.shopify.com/en/manual/promoting-marketing/seo/crawling-your-store