askrobots / dbbasic-browser
Public
A desktop browser with x402 built in: when a page asks for payment, it pays in stablecoins and shows the content.
danq9
toolbar: Back and Forward are greyed out when there's nowhere to go
cc08c7a
1 week, 2 days ago
History
live-net.mjs · 1.7 KB · 24 lines
| 1 | // Touches the real internet (opt-in: E2E_LIVE_NET=1). askrobots.com runs an Anubis bot check on signed-out |
| 2 | // searches: a browser that mishandles redirects or cookies lands on the home page or gets stuck on the challenge. |
| 3 | export default async function (ctx) { |
| 4 | const { call: T, check, sleep } = ctx; |
| 5 | await T("page.goto", { url: "https://askrobots.com/" }); |
| 6 | const href = async () => (await T("page.eval", { js: "location.href" })).value; |
| 7 | check(!(await href()).includes(".within.website"), "the home page loads and the address is clean", await href()); |
| 8 | |
| 9 | // The FIRST click from a brand-new profile (no pass cookie yet) on the sample search. |
| 10 | await T("page.click", { selector: 'a[href*="q=python+tutorial"]' }); |
| 11 | await T("page.waitFor", { url: "/dashboard/search/", timeoutMs: 30000 }).catch(() => {}); |
| 12 | await sleep(1500); |
| 13 | const h = await href(); |
| 14 | const tab = (await T("tabs.list"))[0]; |
| 15 | check(h.includes("/dashboard/search/") && h.includes("python"), "the FIRST click lands on the RESULTS, not the home page", h.slice(0, 100)); |
| 16 | check(tab.url === h, "the address bar equals the page's real location", tab.url.slice(0, 100)); |
| 17 | check(!h.includes(".within.website") && !tab.url.includes("pass-challenge"), "no challenge URL is left in the address bar"); |
| 18 | const txt = (await T("page.text")).text || ""; |
| 19 | check(/python/i.test(txt) && txt.length > 500, "the results page has content", `${txt.length} chars`); |
| 20 | |
| 21 | await T("page.goto", { url: "https://askrobots.com/dashboard/search/?q=houston+weather" }); |
| 22 | const h2 = await href(); |
| 23 | check(h2.includes("/dashboard/search/") && h2.includes("houston"), "a second search needs no new challenge (the pass cookie persisted)", h2.slice(0, 90)); |
| 24 | } |