That opening line hit home. 😅 "Worked yesterday, empty page today" is basically the unofficial scraping job description.
I like your "simplest tool that works" rule. Before reaching for Playwright, I open the browser's Network tab and look for the XHR/fetch call that loads the data. Often it's a clean JSON endpoint, so httpx plus a few headers does the job, and you skip the browser entirely. It's usually 10x faster and breaks less when the UI changes.
Another thing I'd add is that picking the tool is only half the battle. Once you scale, blocks and 403s become the real problem. Rotating IPs, sensible delays, and retries with backoff often matter more than which library you chose.
The HTTPX + Selectolax combo for async scraping is underrated too. 🔥
Curious: Do you check for hidden JSON endpoints first, or go straight to Playwright when you see JS-rendered content?
Thanks! That opening line was written from painful experience, so I'm glad it landed. 😄
Honest answer: I check for hidden JSON endpoints first, almost every time. My routine is to load the page with DevTools open on the Network tab, filter by Fetch/XHR, and reload. If a clean JSON response shows up, I copy it as cURL, strip it down to the headers that matter, and replay it with httpx. When it works, it's faster, cheaper, and far less likely to break when the frontend gets redesigned.
I only go to Playwright when there's no usable endpoint. That usually means the data comes from signed or short-lived tokens, heavy client-side rendering, or flows that depend on real browser behavior like logins, infinite scroll, or anti-bot checks that fingerprint the browser.
You're also right that scale is a different problem from tool choice. Once you're making thousands of requests, proxy rotation, polite delays with jitter, and retries with exponential backoff matter more than whether you picked httpx or Playwright. I should have made that point stronger in the post.
And yes, HTTPX + Selectolax is a seriously underrated pair. 🔥 Thanks for the thoughtful comment!
That cURL → strip headers → replay in httpx routine is exactly how I do it too. One thing I'd add for anyone following it: after stripping the cURL down, test whether the endpoint still works without cookies. If it does, you've got a stable endpoint. If it only works with a fresh session cookie or token, you'll need a small warm-up request first, and that's usually still cheaper than launching a full browser. 🙌
Your list of when to switch to Playwright (signed tokens, logins, fingerprinting) is a clear rule of thumb. I'd bookmark that part.
Thanks for the detailed answer, and for a post that put "simplest tool first" ahead of tool hype. 🔥
Great addition, the cookie test is a smart way to check how stable an endpoint really is. 🙌 If it works without cookies, you have something solid. If it needs a session cookie or token, a small warm-up request (hit the main page or a token endpoint first, then reuse the session) is almost always cheaper than launching a browser.
One caveat I'd add: when tokens are short-lived or signed in the browser (for example by JavaScript that computes a header), a warm-up request won't be enough, and that's where Playwright earns its place.
Thanks for the kind words, and for adding to the post's advice. Comments like yours make the post more useful for everyone who reads it later. 🔥
Good point on the signed headers. That's the one case where a warm-up request won't save you. 👍
Even then, I try to avoid keeping a browser in the loop for every request. Two options before going fully Playwright:
Hybrid approach: Use Playwright only to grab the token or cookies, then reuse them in httpx until they expire. One browser launch can cover hundreds of requests.
Run the signing code directly: If the header is computed by a small JS function, you can often lift it and run it with Node or py_mini_racer, skipping the browser entirely.
If neither works because of heavy fingerprinting, then yes, full Playwright earns its place.
Thanks for the thoughtful replies. This thread alone is a good extension of the post. 🔥
The hybrid approach is my favorite of the three. Using Playwright only to grab the token or cookies, then handing off to httpx, keeps the heavy part to one launch while the requests stay cheap. The only thing I'd add is to watch for expiry and have a refresh path: if you get a 401/403, relaunch the browser, grab fresh cookies, and retry.
Running the signing function directly with Node or py_mini_racer is a great trick too, though it gets fragile when the JS is obfuscated or changes often. At that point a browser is easier to maintain than a reverse-engineered signer.
I agree on the order: Network tab first, then plain requests, then hybrid or lifted signing, and full Playwright only when fingerprinting leaves no other option. Appreciate you adding this to the thread! 🔥
Loved the closing advice to pick the simplest tool that works. Most people jump straight to Playwright when they hit a JS-heavy site, and that's often overkill. 😄
One trick I'd add to your "check how the site serves content" step: open DevTools → Network → Fetch/XHR before launching a browser. Many "JavaScript-rendered" pages just pull their data from a clean JSON endpoint. Hit that directly with HTTPX and you skip the browser, the parsing, and most selector breakage. It's usually 10x faster too.
The HTTPX + Selectolax combo for async scraping is underrated. Great pick. 🔥
Quick question: When a site changes its HTML after you've shipped, do you have any monitoring to catch silent breakage, like alerting when extracted fields suddenly come back empty? That's the failure that hurts me most in production.
Great tip! Checking the Fetch/XHR tab before jumping into browser automation is definitely a smart move. If the data is already available through a JSON endpoint, there's no reason to make scraping more complicated than it needs to be. 😄
And you're absolutely right about silent breakage. I agree that monitoring extracted fields and setting alerts for unexpected empty values or sudden drops in extraction success can save a lot of debugging time. It's something worth building into any production scraping workflow.
Thanks for sharing these practical insights! Really appreciate it. 🔥
Appreciate it! Glad the Fetch/XHR tip was useful. 🙌
On the monitoring side, here's what's worked for me: validate every record against a schema (Pydantic works well), then track the fill rate per field for each run. If a field like price drops from ~98% filled to under 80% compared to its rolling average, it fires an alert. A plain "job succeeded" status never catches this, since the scraper happily returns 200s with empty data.
Curious whether you've built something like this into your own pipelines, or if you'd cover it in a follow-up post? I think "scraper observability" is a topic that doesn't get nearly enough attention. 😄
Tracking fill rate per field against a rolling average is a great approach. A "job succeeded" status only tells you the scraper ran, not that the data is usable. Pairing it with Pydantic validation is a nice touch, since bad records get caught at the source instead of downstream.
In my own pipelines I do something similar. Each run logs how many records came back and how many passed validation, and a sharp drop in either triggers an alert. I also keep a few known URLs as canary pages, so if the selectors break I find out within hours instead of days.
Scraper observability would make a good follow-up post. It's a topic that rarely gets covered, even though it's where most production pain comes from. I'll look into it. 😄
A column most of these comparisons leave out is failure semantics: which failures are still billed, how a timeout is settled, and whether a request that had to be repeated counts twice. Those rules move the monthly invoice more than the headline rate does, especially once you change the unit to price per thousand successful extractions instead of per thousand requests, because a tool that returns half-empty records can look cheap per call and still cost more per usable row. Worth asking for in writing before a trial, since it is the part of the contract that decides what a bad week costs you rather than what a good day looks like. I worked through the credit arithmetic across a few endpoint types here: dev.to/petix_pleasure_2bbaae7ce9/t...
Great point, and I should have covered it. Comparing tools by headline rate hides the thing that actually decides the invoice. Cost per thousand successful, usable extractions is a much more honest unit than cost per thousand requests, especially when retries, timeouts and half-empty records can quietly inflate the bill.
A few things I'd add to your list before committing to any provider:
Ask in writing which outcomes are billed: timeouts, blocked requests, 4xx/5xx responses, and retries made by the provider's own infrastructure.
Track cost per valid row on your side. Combine the vendor's billing data with your own field-level validation (required fields present, patterns match) so you can see the true cost of a bad week, not just a good day.
Run the trial on your hardest targets, not the easy ones. Failure semantics only show up under stress.
Your credit arithmetic across endpoint types sounds useful, but the link in your comment looks cut off for me. Could you repost the full URL? Thanks for sharing. 🙌
On your second point, one thing worth adding: field-level validation catches half-empty records, but it will not catch a page that was fetched successfully and is genuinely empty. Those two look identical to a row-count check, and they settle differently on the invoice: one is a defect in your extraction, the other is a correct answer that still costs a credit. Track them as separate counters from day one, or the cost-per-valid-row figure drifts in whichever direction your validation is weaker.
That also sharpens your hardest-targets advice: run them twice, once with validation on and once with it off, and see whether the gap is extraction or absence.
Good distinction, and it fixes a gap in my second point. Field-level validation alone can't separate "the extractor missed it" from "there was nothing there," and a row-count check treats both as the same zero.
Two additions:
Split the counters into at least three buckets: extraction defect, genuinely empty page, and a soft block. Some sites return a 200 with a captcha, a consent wall, or a placeholder template, and that looks exactly like a genuinely empty page unless you check for it. Without that third bucket, blocks get filed as "absence" and the vendor never gets blamed for them.
Keep a small hand-verified sample of known-populated URLs and run it on every provider. If a page you know has data comes back empty, that's a defect or a block, not absence. It gives you a ground-truth baseline for the cost-per-valid-row figure.
Your validation on/off idea is a clean way to test hard targets. If the gap between the two runs is large, the problem is extraction. If both runs agree, you're paying for correct answers that happen to be empty, and that's a targeting problem rather than a tooling one.
Thanks for the follow-up, this made the post's cost section a lot more useful. 🙌
Splitting the tools into ones that fetch pages, ones that parse HTML, and ones that drive a browser makes the choice much easier than the usual "X vs Y" posts, and "pick the simplest tool that collects the data reliably" is the right rule to end on.
One step I'd add before reaching for Playwright on a JavaScript-heavy site is to open the browser's Network tab and watch what loads. A lot of these pages pull their content from a JSON endpoint in the background. If you can call that endpoint directly with Requests or HTTPX, you skip the browser entirely and get cleaner data that breaks less often when the page layout changes.
Have you tried scrapy-playwright for cases where you need Scrapy's scheduling and retries but the site still renders with JavaScript? I'm curious whether the extra resource cost was worth it at scale.
Thanks, glad the fetch / parse / browser split made the choice clearer. 🙌 And yes, the Network tab check is one of the highest-value steps. If the page loads its data from a JSON endpoint, calling it directly with HTTPX is faster and usually survives layout changes far better. A couple of readers have suggested adding it to the post.
On scrapy-playwright: it's a good fit when you want Scrapy's scheduling, retries, pipelines and throttling but a few pages still need JavaScript rendering. The cost is real, though. Browser pages use much more CPU and memory than plain HTTP requests, so concurrency drops and per-page time goes up. What works best is to keep Playwright off by default and enable it per request (for example, only for the pages that truly need it), and let everything else go through Scrapy's normal downloader. Blocking images, fonts and other unneeded resources also cuts the cost noticeably.
At scale, I'd say it's worth it only for the subset of pages that can't be reached any other way. If most of your pages need rendering, a leaner setup (or the JSON endpoint route) usually wins.
Have you run it in production? I'd love to hear what worked for you. 🔥
That opening line hit home. A scraper that "worked yesterday" and now returns an empty page is basically a rite of passage. 😅
Your "pick the simplest tool that works" advice is the part I'd underline. One trick that saves me from reaching for Playwright too early: open the browser's Network tab, filter by Fetch/XHR, and reload the page. Quite often the JS-rendered data comes from a clean JSON endpoint, and then plain Requests or HTTPX does the job without a headless browser.
Do you have a quick rule for when you give up on the endpoint and switch to Playwright?
Thanks! That "worked yesterday, empty page today" feeling is real. 😅
The Network tab is always my first step too, and you're right that it saves a lot of unnecessary headless browser runs.
My rule of thumb for giving up on the endpoint is to time-box it. If I can't replay the XHR request with requests/HTTPX (copying it as cURL from DevTools) within about 20-30 minutes, I switch to Playwright. The usual reasons it fails:
Signed or short-lived tokens: The request needs headers or params generated by obfuscated JS (HMAC signatures, rotating tokens) that aren't worth reverse-engineering.
Bot protection: Cloudflare or fingerprinting blocks plain HTTP clients even with identical headers and cookies.
No clean JSON: The data is assembled client-side from several calls, websockets, or rendered straight into the DOM.
Heavy login flows: Multi-step auth, CAPTCHAs, or JS-driven redirects.
Even after switching, I still lean on that Network tab idea. With Playwright you can listen to page.on("response", ...) and grab the JSON the page itself fetches, so you skip fragile DOM selectors. Another hybrid that works well is letting Playwright log in once, then handing the cookies to HTTPX for the bulk requests.
Do you have a similar cutoff, or is it more by feel?
Time-boxing is a smart rule, and your list of failure reasons is a handy checklist. My cutoff is more by feel than by a stopwatch, but there's one signal I treat as a hard stop: if the request depends on a token or signature generated in obfuscated JS and I can't find where it's produced after a quick look at the Initiator tab in DevTools, I switch to Playwright right away. Reverse-engineering HMAC logic rarely pays off, because it breaks the next time the site ships a new bundle.
The page.on("response", ...) hybrid is a great tip. I hadn't thought about reusing it to skip DOM selectors entirely. Letting Playwright log in once and handing the cookies to HTTPX for the bulk work is also a nice way to keep runs fast.
That's a solid hard-stop signal. If the token comes from obfuscated JS and the Initiator tab doesn't lead you to where it's generated, it's rarely worth the time. 👍 And you're right that it breaks again as soon as the site ships a new bundle, so you'd be paying for that reverse-engineering over and over.
Glad the page.on("response", ...) and cookie hand-off tips were useful. One caveat on the hand-off: session cookies can expire or get tied to the browser's fingerprint, so I add a quick check in the HTTPX loop. If a request comes back with a login redirect or a 401/403, it triggers a fresh Playwright login instead of failing silently.
We're a place where coders share, stay up-to-date and grow their careers.
That opening line hit home. 😅 "Worked yesterday, empty page today" is basically the unofficial scraping job description.
I like your "simplest tool that works" rule. Before reaching for Playwright, I open the browser's Network tab and look for the XHR/fetch call that loads the data. Often it's a clean JSON endpoint, so httpx plus a few headers does the job, and you skip the browser entirely. It's usually 10x faster and breaks less when the UI changes.
Another thing I'd add is that picking the tool is only half the battle. Once you scale, blocks and 403s become the real problem. Rotating IPs, sensible delays, and retries with backoff often matter more than which library you chose.
The
HTTPX + Selectolaxcombo for async scraping is underrated too. 🔥Curious: Do you check for hidden JSON endpoints first, or go straight to Playwright when you see JS-rendered content?
Thanks! That opening line was written from painful experience, so I'm glad it landed. 😄
Honest answer: I check for hidden JSON endpoints first, almost every time. My routine is to load the page with DevTools open on the Network tab, filter by Fetch/XHR, and reload. If a clean JSON response shows up, I copy it as cURL, strip it down to the headers that matter, and replay it with httpx. When it works, it's faster, cheaper, and far less likely to break when the frontend gets redesigned.
I only go to Playwright when there's no usable endpoint. That usually means the data comes from signed or short-lived tokens, heavy client-side rendering, or flows that depend on real browser behavior like logins, infinite scroll, or anti-bot checks that fingerprint the browser.
You're also right that scale is a different problem from tool choice. Once you're making thousands of requests, proxy rotation, polite delays with jitter, and retries with exponential backoff matter more than whether you picked httpx or Playwright. I should have made that point stronger in the post.
And yes, HTTPX + Selectolax is a seriously underrated pair. 🔥 Thanks for the thoughtful comment!
That cURL → strip headers → replay in httpx routine is exactly how I do it too. One thing I'd add for anyone following it: after stripping the cURL down, test whether the endpoint still works without cookies. If it does, you've got a stable endpoint. If it only works with a fresh session cookie or token, you'll need a small warm-up request first, and that's usually still cheaper than launching a full browser. 🙌
Your list of when to switch to Playwright (signed tokens, logins, fingerprinting) is a clear rule of thumb. I'd bookmark that part.
Thanks for the detailed answer, and for a post that put "simplest tool first" ahead of tool hype. 🔥
Great addition, the cookie test is a smart way to check how stable an endpoint really is. 🙌 If it works without cookies, you have something solid. If it needs a session cookie or token, a small warm-up request (hit the main page or a token endpoint first, then reuse the session) is almost always cheaper than launching a browser.
One caveat I'd add: when tokens are short-lived or signed in the browser (for example by JavaScript that computes a header), a warm-up request won't be enough, and that's where Playwright earns its place.
Thanks for the kind words, and for adding to the post's advice. Comments like yours make the post more useful for everyone who reads it later. 🔥
Good point on the signed headers. That's the one case where a warm-up request won't save you. 👍
Even then, I try to avoid keeping a browser in the loop for every request. Two options before going fully Playwright:
If neither works because of heavy fingerprinting, then yes, full Playwright earns its place.
Thanks for the thoughtful replies. This thread alone is a good extension of the post. 🔥
The hybrid approach is my favorite of the three. Using Playwright only to grab the token or cookies, then handing off to httpx, keeps the heavy part to one launch while the requests stay cheap. The only thing I'd add is to watch for expiry and have a refresh path: if you get a 401/403, relaunch the browser, grab fresh cookies, and retry.
Running the signing function directly with Node or py_mini_racer is a great trick too, though it gets fragile when the JS is obfuscated or changes often. At that point a browser is easier to maintain than a reverse-engineered signer.
I agree on the order: Network tab first, then plain requests, then hybrid or lifted signing, and full Playwright only when fingerprinting leaves no other option. Appreciate you adding this to the thread! 🔥
Loved the closing advice to pick the simplest tool that works. Most people jump straight to Playwright when they hit a JS-heavy site, and that's often overkill. 😄
One trick I'd add to your "check how the site serves content" step: open DevTools → Network → Fetch/XHR before launching a browser. Many "JavaScript-rendered" pages just pull their data from a clean JSON endpoint. Hit that directly with HTTPX and you skip the browser, the parsing, and most selector breakage. It's usually 10x faster too.
The HTTPX + Selectolax combo for async scraping is underrated. Great pick. 🔥
Quick question: When a site changes its HTML after you've shipped, do you have any monitoring to catch silent breakage, like alerting when extracted fields suddenly come back empty? That's the failure that hurts me most in production.
Great tip! Checking the Fetch/XHR tab before jumping into browser automation is definitely a smart move. If the data is already available through a JSON endpoint, there's no reason to make scraping more complicated than it needs to be. 😄
And you're absolutely right about silent breakage. I agree that monitoring extracted fields and setting alerts for unexpected empty values or sudden drops in extraction success can save a lot of debugging time. It's something worth building into any production scraping workflow.
Thanks for sharing these practical insights! Really appreciate it. 🔥
Appreciate it! Glad the Fetch/XHR tip was useful. 🙌
On the monitoring side, here's what's worked for me: validate every record against a schema (Pydantic works well), then track the fill rate per field for each run. If a field like
pricedrops from ~98% filled to under 80% compared to its rolling average, it fires an alert. A plain "job succeeded" status never catches this, since the scraper happily returns 200s with empty data.Curious whether you've built something like this into your own pipelines, or if you'd cover it in a follow-up post? I think "scraper observability" is a topic that doesn't get nearly enough attention. 😄
Tracking fill rate per field against a rolling average is a great approach. A "job succeeded" status only tells you the scraper ran, not that the data is usable. Pairing it with Pydantic validation is a nice touch, since bad records get caught at the source instead of downstream.
In my own pipelines I do something similar. Each run logs how many records came back and how many passed validation, and a sharp drop in either triggers an alert. I also keep a few known URLs as canary pages, so if the selectors break I find out within hours instead of days.
Scraper observability would make a good follow-up post. It's a topic that rarely gets covered, even though it's where most production pain comes from. I'll look into it. 😄
A column most of these comparisons leave out is failure semantics: which failures are still billed, how a timeout is settled, and whether a request that had to be repeated counts twice. Those rules move the monthly invoice more than the headline rate does, especially once you change the unit to price per thousand successful extractions instead of per thousand requests, because a tool that returns half-empty records can look cheap per call and still cost more per usable row. Worth asking for in writing before a trial, since it is the part of the contract that decides what a bad week costs you rather than what a good day looks like. I worked through the credit arithmetic across a few endpoint types here: dev.to/petix_pleasure_2bbaae7ce9/t...
Great point, and I should have covered it. Comparing tools by headline rate hides the thing that actually decides the invoice. Cost per thousand successful, usable extractions is a much more honest unit than cost per thousand requests, especially when retries, timeouts and half-empty records can quietly inflate the bill.
A few things I'd add to your list before committing to any provider:
Ask in writing which outcomes are billed: timeouts, blocked requests, 4xx/5xx responses, and retries made by the provider's own infrastructure.
Track cost per valid row on your side. Combine the vendor's billing data with your own field-level validation (required fields present, patterns match) so you can see the true cost of a bad week, not just a good day.
Run the trial on your hardest targets, not the easy ones. Failure semantics only show up under stress.
Your credit arithmetic across endpoint types sounds useful, but the link in your comment looks cut off for me. Could you repost the full URL? Thanks for sharing. 🙌
Thanks, and you're right that it got truncated. dev.to cuts long bare URLs in comments, so here it is as a link instead: the credit arithmetic across endpoint types
On your second point, one thing worth adding: field-level validation catches half-empty records, but it will not catch a page that was fetched successfully and is genuinely empty. Those two look identical to a row-count check, and they settle differently on the invoice: one is a defect in your extraction, the other is a correct answer that still costs a credit. Track them as separate counters from day one, or the cost-per-valid-row figure drifts in whichever direction your validation is weaker.
That also sharpens your hardest-targets advice: run them twice, once with validation on and once with it off, and see whether the gap is extraction or absence.
Good distinction, and it fixes a gap in my second point. Field-level validation alone can't separate "the extractor missed it" from "there was nothing there," and a row-count check treats both as the same zero.
Two additions:
Split the counters into at least three buckets: extraction defect, genuinely empty page, and a soft block. Some sites return a 200 with a captcha, a consent wall, or a placeholder template, and that looks exactly like a genuinely empty page unless you check for it. Without that third bucket, blocks get filed as "absence" and the vendor never gets blamed for them.
Keep a small hand-verified sample of known-populated URLs and run it on every provider. If a page you know has data comes back empty, that's a defect or a block, not absence. It gives you a ground-truth baseline for the cost-per-valid-row figure.
Your validation on/off idea is a clean way to test hard targets. If the gap between the two runs is large, the problem is extraction. If both runs agree, you're paying for correct answers that happen to be empty, and that's a targeting problem rather than a tooling one.
Thanks for the follow-up, this made the post's cost section a lot more useful. 🙌
Splitting the tools into ones that fetch pages, ones that parse HTML, and ones that drive a browser makes the choice much easier than the usual "X vs Y" posts, and "pick the simplest tool that collects the data reliably" is the right rule to end on.
One step I'd add before reaching for Playwright on a JavaScript-heavy site is to open the browser's Network tab and watch what loads. A lot of these pages pull their content from a JSON endpoint in the background. If you can call that endpoint directly with Requests or HTTPX, you skip the browser entirely and get cleaner data that breaks less often when the page layout changes.
Have you tried scrapy-playwright for cases where you need Scrapy's scheduling and retries but the site still renders with JavaScript? I'm curious whether the extra resource cost was worth it at scale.
Thanks, glad the fetch / parse / browser split made the choice clearer. 🙌 And yes, the Network tab check is one of the highest-value steps. If the page loads its data from a JSON endpoint, calling it directly with HTTPX is faster and usually survives layout changes far better. A couple of readers have suggested adding it to the post.
On scrapy-playwright: it's a good fit when you want Scrapy's scheduling, retries, pipelines and throttling but a few pages still need JavaScript rendering. The cost is real, though. Browser pages use much more CPU and memory than plain HTTP requests, so concurrency drops and per-page time goes up. What works best is to keep Playwright off by default and enable it per request (for example, only for the pages that truly need it), and let everything else go through Scrapy's normal downloader. Blocking images, fonts and other unneeded resources also cuts the cost noticeably.
At scale, I'd say it's worth it only for the subset of pages that can't be reached any other way. If most of your pages need rendering, a leaner setup (or the JSON endpoint route) usually wins.
Have you run it in production? I'd love to hear what worked for you. 🔥
That opening line hit home. A scraper that "worked yesterday" and now returns an empty page is basically a rite of passage. 😅
Your "pick the simplest tool that works" advice is the part I'd underline. One trick that saves me from reaching for Playwright too early: open the browser's Network tab, filter by Fetch/XHR, and reload the page. Quite often the JS-rendered data comes from a clean JSON endpoint, and then plain Requests or HTTPX does the job without a headless browser.
Do you have a quick rule for when you give up on the endpoint and switch to Playwright?
Thanks! That "worked yesterday, empty page today" feeling is real. 😅
The Network tab is always my first step too, and you're right that it saves a lot of unnecessary headless browser runs.
My rule of thumb for giving up on the endpoint is to time-box it. If I can't replay the XHR request with
requests/HTTPX (copying it as cURL from DevTools) within about 20-30 minutes, I switch to Playwright. The usual reasons it fails:Even after switching, I still lean on that Network tab idea. With Playwright you can listen to
page.on("response", ...)and grab the JSON the page itself fetches, so you skip fragile DOM selectors. Another hybrid that works well is letting Playwright log in once, then handing the cookies to HTTPX for the bulk requests.Do you have a similar cutoff, or is it more by feel?
Time-boxing is a smart rule, and your list of failure reasons is a handy checklist. My cutoff is more by feel than by a stopwatch, but there's one signal I treat as a hard stop: if the request depends on a token or signature generated in obfuscated JS and I can't find where it's produced after a quick look at the Initiator tab in DevTools, I switch to Playwright right away. Reverse-engineering HMAC logic rarely pays off, because it breaks the next time the site ships a new bundle.
The
page.on("response", ...)hybrid is a great tip. I hadn't thought about reusing it to skip DOM selectors entirely. Letting Playwright log in once and handing the cookies to HTTPX for the bulk work is also a nice way to keep runs fast.That's a solid hard-stop signal. If the token comes from obfuscated JS and the Initiator tab doesn't lead you to where it's generated, it's rarely worth the time. 👍 And you're right that it breaks again as soon as the site ships a new bundle, so you'd be paying for that reverse-engineering over and over.
Glad the
page.on("response", ...)and cookie hand-off tips were useful. One caveat on the hand-off: session cookies can expire or get tied to the browser's fingerprint, so I add a quick check in the HTTPX loop. If a request comes back with a login redirect or a 401/403, it triggers a fresh Playwright login instead of failing silently.