[{"data":1,"prerenderedAt":477},["ShallowReactive",2],{"SiteFooter_cLEacilcm59lTjFJjLY6mXNWLL0ETtzOIiZwIHgDpy0":3,"doc-\u002Fdocs\u002Fhttp\u002Foverview":17,"docs-nav":324,"nav-compare":465,"editor-1guzbdt":475},["Island",4],{"key":5,"result":6},"SiteFooter_cLEacilcm59lTjFJjLY6mXNWLL0ETtzOIiZwIHgDpy0",{"head":7},{"style":8},[9,11,13,15],{"innerHTML":10},".site-footer[data-v-8bb1d4ae]{border-top:1px solid var(--line);background:var(--chrome);padding:var(--sp-8) var(--gutter) var(--sp-10);gap:var(--sp-6);flex-direction:column;display:flex}.links[data-v-8bb1d4ae]{gap:var(--sp-4);grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));max-width:62rem;display:grid}.links a[data-v-8bb1d4ae]{align-items:flex-start;gap:var(--sp-3);padding:var(--sp-3);border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--panel);color:var(--ink);border-bottom:1px solid var(--line);display:flex}.links a[data-v-8bb1d4ae]:focus-visible,.links a[data-v-8bb1d4ae]:hover{border-color:var(--line-strong)}.links[data-v-8bb1d4ae] .mark,.links[data-v-8bb1d4ae] .rf-mark{width:1.35rem;height:1.35rem;color:var(--dim);flex:none;margin-top:.1rem}.links a[data-v-8bb1d4ae]:hover .mark,.links a[data-v-8bb1d4ae]:hover .rf-mark{color:var(--red)}.links span[data-v-8bb1d4ae]{flex-direction:column;gap:2px;min-width:0;display:flex}.links b[data-v-8bb1d4ae]{font-family:var(--font-display);font-size:.85rem;font-weight:400}.links small[data-v-8bb1d4ae]{color:var(--faint);font-size:.78rem}.colophon[data-v-8bb1d4ae]{color:var(--faint);margin:0;font-size:.75rem}@supports (corner-shape:bevel){.links a[data-v-8bb1d4ae]{corner-shape:bevel}}",{"innerHTML":12},".mark[data-v-cc0d96a5]{vertical-align:-.125em;flex:none;width:1em;height:1em}",{"innerHTML":14},".mark[data-v-26f5673d]{vertical-align:-.125em;flex:none;width:1em;height:1em}",{"innerHTML":16},".rf-mark[data-v-26317b3e]{fill:currentColor;stroke:none;flex:none}",{"id":18,"title":19,"body":20,"description":314,"extension":315,"meta":316,"navigation":317,"order":318,"path":319,"section":320,"seo":321,"stem":322,"__hash__":323},"docs\u002Fdocs\u002Fhttp\u002Foverview.md","HTTP traffic",{"type":21,"value":22,"toc":305},"minimark",[23,27,33,38,41,52,56,67,71,81,86,124,128,156,160,171,174,198,202,256,272,276,285],[24,25,26],"p",{},"Browser has keywords to send HTTP requests, to wait for them and to change them:",[28,29],"doc-table",{":head":30,":rows":31,":nowrap":32},"[\"Keyword\",\"Does\",\"Page\"]","[[\"[`HTTP`](\u002Fkeywords#http)\",\"Sends a request from the page, with its `fetch`\",\"[Sending requests](\u002Fdocs\u002Fhttp\u002Fsending-requests)\"],[\"[`Send API Request`](\u002Fkeywords#send-api-request)\",\"Sends a request from the context, outside any page\",\"[Sending requests](\u002Fdocs\u002Fhttp\u002Fsending-requests)\"],[\"[`Wait For Request`](\u002Fkeywords#wait-for-request), [`Wait For Response`](\u002Fkeywords#wait-for-response)\",\"Wait for a request or response of the page\",\"[Waiting for traffic](\u002Fdocs\u002Fhttp\u002Fwaiting)\"],[\"[`Abort Requests`](\u002Fkeywords#abort-requests), [`Mock Responses`](\u002Fkeywords#mock-responses), [`Modify Responses`](\u002Fkeywords#modify-responses)\",\"Fail, answer or change requests of the page\",\"[Route rules](\u002Fdocs\u002Fhttp\u002Froute-rules)\"],[\"[`Remove Route Rule`](\u002Fkeywords#remove-route-rule), [`Remove All Route Rules`](\u002Fkeywords#remove-all-route-rules)\",\"End route rules\",\"[Route rules](\u002Fdocs\u002Fhttp\u002Froute-rules#removing-rules)\"]]","[0]",[34,35,37],"h2",{"id":36},"page-traffic-and-api-traffic","Page traffic and API traffic",[24,39,40],{},"There are two kinds of requests, and they see different things:",[42,43,49],"pre",{"className":44,"code":46,"language":47,"meta":48},[45],"language-text","page traffic     the page loads, fetches, posts …  and HTTP\n                 Page ──▶ route rules ──▶ network ──▶ Server\n                   └── seen by Wait For Request \u002F Wait For Response\n\nAPI traffic      Send API Request\n                 Context ───────────────▶ network ──▶ Server\n","text","",[50,51,46],"code",{"__ignoreMap":48},[28,53],{":head":54,":rows":55},"[\"\",\"Page traffic, HTTP\",\"Send API Request\"]","[[\"Route rules\",\"apply\",\"do not apply\"],[\"Wait For Request \u002F Response\",\"see it\",\"do not see it\"],[\"Set Offline\",\"requests fail\",\"no effect\"],[\"Context cookies\",\"by the `credentials` option of `fetch`\",\"always; cookies it gets reach the pages\"],[\"Extra HTTP headers\",\"sent\",\"sent, but not those set `on=Page`\"],[\"HTTP credentials\",\"sent\",\"sent\"],[\"Relative URL\",\"against the page URL\",\"against `baseURL`, fails without one\"],[\"CORS, headers such as `Cookie`\",\"browser rules apply\",\"no rules\"],[\"Needs\",\"a page\",\"a context\"]]",[24,57,58,59,62,63,66],{},"So ",[50,60,61],{},"HTTP"," tests what the page can do, and ",[50,64,65],{},"Send API Request"," sets up or checks data\nnext to it, for example with the session the page logged in with.",[34,68,70],{"id":69},"matchers","Matchers",[24,72,73,76,77,80],{},[50,74,75],{},"Wait For *"," and the route rules take the same ",[50,78,79],{},"matcher",":",[28,82],{":head":83,":rows":84,":nowrap":85},"[\"Matcher\",\"Example\"]","[[\"Glob: `*` stops at `\u002F`, `**` does not, `{a,b}` is either\",\"`**\u002Fapi\u002Forders\u002F*`\"],[\"JavaScript RegExp between slashes, with optional flags `gimsuy`\",\"`\u002F\\\\\u002Fapi\\\\\u002Forders\\\\\u002F\\\\d+$\u002Fi`\"],[\"JavaScript arrow function that returns a boolean\",\"`url => url.pathname.endsWith('.png')`\"]]","[1]",[87,88,89,93,108,114],"ul",{},[90,91,92],"li",{},"An invalid RegExp fails the keyword. It never falls back to a glob.",[90,94,95,96,99,100,103,104,107],{},"Anything that starts and ends with ",[50,97,98],{},"\u002F"," is a RegExp: ",[50,101,102],{},"\u002Fapi\u002Fusers\u002F"," is one. Write\n",[50,105,106],{},"**\u002Fapi\u002Fusers\u002F"," for the glob.",[90,109,110,111,113],{},"The arrow function gets the request URL in a route rule, and the request or\nresponse in ",[50,112,75],{},".",[90,115,116,117,120,121,113],{},"Escape backslashes for Robot Framework: ",[50,118,119],{},"\\\\d"," instead of ",[50,122,123],{},"\\d",[34,125,127],{"id":126},"bodies","Bodies",[24,129,130,133,134,136,137,140,141,136,144,147,148,140,150,133,153,155],{},[50,131,132],{},"body"," of ",[50,135,61],{},", ",[50,138,139],{},"Mock Responses"," and ",[50,142,143],{},"Modify Responses",[50,145,146],{},"request_body"," of\n",[50,149,143],{},[50,151,152],{},"data",[50,154,65],{}," take the same values:",[28,157],{":head":158,":rows":159,":nowrap":32},"[\"Value\",\"Sent as\"]","[[\"Dictionary, list, number, boolean\",\"Compact JSON, `application\u002Fjson`\"],[\"Text\",\"UTF-8, as given. The Content-Type differs per keyword, see its page\"],[\"`bytes`\",\"Unchanged, byte for byte\"],[\"Robot Framework `Secret`\",\"Its text, never logged\"]]",[24,161,162,163,166,167,170],{},"A Content-Type in ",[50,164,165],{},"headers"," always wins. A value JSON cannot hold, such as ",[50,168,169],{},"NaN"," or\na date, fails before anything is sent.",[34,172,173],{"id":165},"Headers",[24,175,176,177,180,181,140,184,187,188,136,190,193,194,197],{},"Headers are a dictionary. A value is text, a ",[50,178,179],{},"Secret",", a number or a boolean;\nnumbers and booleans are sent as JavaScript writes them, ",[50,182,183],{},"5",[50,185,186],{},"true",". In\n",[50,189,143],{},[50,191,192],{},"None"," removes a header and ",[50,195,196],{},"\"\""," sends it empty.",[34,199,201],{"id":200},"responses","Responses",[24,203,204,136,206,140,208,211,212,136,215,136,218,136,221,136,224,136,226,136,229,231,232,235,236,243,244,231,250,113],{},[50,205,61],{},[50,207,65],{},[50,209,210],{},"Wait For Response"," return a dictionary with the same\ncore keys: ",[50,213,214],{},"status",[50,216,217],{},"statusText",[50,219,220],{},"ok",[50,222,223],{},"url",[50,225,165],{},[50,227,228],{},"bytes",[50,230,47],{}," and\n",[50,233,234],{},"json",". Each adds its own, see ",[237,238,240],"a",{"href":239},"\u002Fkeywords#type--httpresponse",[50,241,242],{},"HttpResponse",",\n",[237,245,247],{"href":246},"\u002Fkeywords#type--apiresponse",[50,248,249],{},"APIResponse",[237,251,253],{"href":252},"\u002Fkeywords#type--capturedresponse",[50,254,255],{},"CapturedResponse",[257,258,259],"doc-note",{},[24,260,261,262,265,266,136,269,271],{},"Assign a response with ",[50,263,264],{},"${response} =",". With ",[50,267,268],{},"&{response} =",[50,270,228],{}," holds base64\ntext instead of the raw bytes.",[34,273,275],{"id":274},"secrets","Secrets",[24,277,278,279,284],{},"Give tokens as a Robot Framework\n",[237,280,179],{"href":281,"rel":282},"https:\u002F\u002Frobotframework.org\u002Frobotframework\u002Flatest\u002FRobotFrameworkUserGuide.html#secret-variables",[283],"nofollow",",\nas a header value or as the whole body. The keywords log header names, never values.\nTwo limits:",[87,286,287,298],{},[90,288,289,290,293,294,297],{},"A Secret inside text, such as ",[50,291,292],{},"{\"token\": \"${token}\"}",", becomes the text\n",[50,295,296],{},"\u003Csecret>",". Give the whole body as the Secret.",[90,299,300,301,304],{},"With ",[50,302,303],{},"enable_playwright_debug",", the values show in the Playwright debug log.",{"title":48,"searchDepth":306,"depth":306,"links":307},2,[308,309,310,311,312,313],{"id":36,"depth":306,"text":37},{"id":69,"depth":306,"text":70},{"id":126,"depth":306,"text":127},{"id":165,"depth":306,"text":173},{"id":200,"depth":306,"text":201},{"id":274,"depth":306,"text":275},"Send requests, wait for them, and fail, mock or change them. Which keyword sees which request, and the rules they share for matchers, bodies and headers.","md",{},true,1,"\u002Fdocs\u002Fhttp\u002Foverview","http",{"title":19,"description":314},"docs\u002Fhttp\u002Foverview","MzWqqs-nuM8eBNnvd4M5KOpTYPs6OqQYj1nubP_jIto",[325,331,336,340,345,349,354,359,363,367,371,375,379,380,384,388,392,397,401,405,409,414,418,422,426,431,435,440,444,448,452,456,461],{"path":326,"title":327,"description":328,"section":329,"order":330},"\u002Fdocs\u002Fconcepts\u002Farchitecture","How Browser works","Python, a Node process and Playwright — what runs where, and where the files land.","concepts",5,{"path":332,"title":333,"description":334,"section":329,"order":335},"\u002Fdocs\u002Fconcepts\u002Fassertions","Assertions","Almost every getter can assert, every assertion retries, and each return type allows different operators. The complete AssertionEngine reference.",3,{"path":337,"title":338,"description":339,"section":329,"order":318},"\u002Fdocs\u002Fconcepts\u002Fbrowser-context-page","Browser, context and page","The three layers Playwright is built on — and why a new context is the cheapest clean slate you will ever get.",{"path":341,"title":342,"description":343,"section":329,"order":344},"\u002Fdocs\u002Fconcepts\u002Flogging","Logging and debugging","Four places Browser tells you what happened — log.html, the Playwright log, traces and coverage.",6,{"path":346,"title":347,"description":348,"section":329,"order":306},"\u002Fdocs\u002Fconcepts\u002Fselectors","Finding elements","Which selector strategy to reach for, why the order matters, and how to chain across iframes and shadow DOM.",{"path":350,"title":351,"description":352,"section":329,"order":353},"\u002Fdocs\u002Fconcepts\u002Fwaiting","Waiting and promises","Most waiting is already done for you. This is the rest of it — Wait For Condition, and how to run keywords in parallel with Promise To.",4,{"path":355,"title":356,"description":357,"section":358,"order":330},"\u002Fdocs\u002Fextending\u002Fbrowser-as-a-base","Browser as a base","Own the Browser instance in your own library — what you get free, what one line restores, and what you build yourself.","extending",{"path":360,"title":361,"description":362,"section":358,"order":306},"\u002Fdocs\u002Fextending\u002Fjavascript-basics","Just enough JavaScript","The JavaScript you need to write extensions and Evaluate JavaScript, for people who write Python.",{"path":364,"title":365,"description":366,"section":358,"order":335},"\u002Fdocs\u002Fextending\u002Fjavascript-extensions","JavaScript extensions","Add keywords that run on the Node side with full Playwright access — and attach a debugger to them.",{"path":368,"title":369,"description":370,"section":358,"order":353},"\u002Fdocs\u002Fextending\u002Fpython-libraries","Your own Python library","Move business logic out of Robot Framework and keep Browser exactly as it is.",{"path":372,"title":373,"description":374,"section":358,"order":318},"\u002Fdocs\u002Fextending\u002Fpython-plugins","Python plugins","Add or replace keywords from Python, with access to the library's own API and to the Node side.",{"path":376,"title":377,"description":378,"section":358,"order":344},"\u002Fdocs\u002Fextending\u002Ftranslations","Translating keywords","Using a translation package to get keyword names and documentation in your language, and writing one for a language nobody has covered yet.",{"path":319,"title":19,"description":314,"section":320,"order":318},{"path":381,"title":382,"description":383,"section":320,"order":353},"\u002Fdocs\u002Fhttp\u002Froute-rules","Route rules","Make requests of the page fail, answer them with a mock response, or change the real request and response. Where a rule lives, when it ends, and which one wins.",{"path":385,"title":386,"description":387,"section":320,"order":306},"\u002Fdocs\u002Fhttp\u002Fsending-requests","Sending requests","HTTP sends a request from the page, Send API Request from the context. Which one to use, and how each sends bodies, forms and files.",{"path":389,"title":390,"description":391,"section":320,"order":335},"\u002Fdocs\u002Fhttp\u002Fwaiting","Waiting for traffic","Wait For Request and Wait For Response wait for a request or response of the page and return what was sent and received. Start the wait before the action, with Promise To.",{"path":393,"title":394,"description":395,"section":396,"order":353},"\u002Fdocs\u002Fmobile\u002Fdevice-list","Every device descriptor","The full list of names Get Device accepts, with the viewport, pixel ratio, touch and engine each one sets — filterable and sortable.","mobile",{"path":398,"title":399,"description":400,"section":396,"order":306},"\u002Fdocs\u002Fmobile\u002Fdevices","Emulating a device","Device descriptors, what the six or seven properties they set actually change, and the one that emulation cannot give you.",{"path":402,"title":403,"description":404,"section":396,"order":318},"\u002Fdocs\u002Fmobile\u002Fresponsive","Testing responsive pages","Why a browser at a phone-sized viewport tests responsiveness properly, what emulation cannot tell you, and where real devices actually belong.",{"path":406,"title":407,"description":408,"section":396,"order":335},"\u002Fdocs\u002Fmobile\u002Ftouch","Touch, permissions and location","Tap and why it needs hasTouch, granting camera or notifications without a dialog, faking where the user is, and the gestures Browser has no keyword for.",{"path":410,"title":411,"description":412,"section":413,"order":335},"\u002Fdocs\u002Foperations\u002Fdocker","Running in Docker","The published Browser image, the four docker run flags that matter, and why running as root breaks Chromium.","operations",{"path":415,"title":416,"description":417,"section":413,"order":353},"\u002Fdocs\u002Foperations\u002Fdocker-images","Building your own image","Extending the published image with your dependencies, the version lock between Browser and Playwright, and using it as a CI job container.",{"path":419,"title":420,"description":421,"section":413,"order":306},"\u002Fdocs\u002Foperations\u002Fenvironment-variables","Environment variables","The variables that change how Browser behaves, which of them are safe in production, and the import parameters that should usually be preferred.",{"path":423,"title":424,"description":425,"section":413,"order":318},"\u002Fdocs\u002Foperations\u002Fnode-process","The Node process","Browser starts a Node process to talk to Playwright. What that costs, how to share one across parallel runs, and how to pass it Node flags.",{"path":427,"title":428,"description":429,"section":430,"order":335},"\u002Fdocs\u002Frecording\u002Farguments","Keyword arguments","Turn a recorded value, part of it or part of a selector into an argument while you record — with or without a default, and everywhere it occurs.","recording",{"path":432,"title":433,"description":434,"section":430,"order":330},"\u002Fdocs\u002Frecording\u002Ffiles","Where recorded keywords go","The suite file, a resource file or only the log; written live after every action; what the recorder changes in a file and what it never touches.",{"path":436,"title":437,"description":438,"section":430,"order":439},"\u002Fdocs\u002Frecording\u002Fpractice","Good practice and limits","How to record keywords worth keeping, what to check before you commit one, what the recorder cannot do, and what to do when it goes wrong.",7,{"path":441,"title":442,"description":443,"section":430,"order":318},"\u002Fdocs\u002Frecording\u002Frecord-keywords","Recording keywords","Click through the page and get a reusable user keyword, written into your suite while you work. Record Keyword and Record Keywords in five minutes.",{"path":445,"title":446,"description":447,"section":430,"order":344},"\u002Fdocs\u002Frecording\u002Fselectors","Recording selectors","Pick an element in the live browser and get a selector for it — Playwright's or a CSS one, checked against the page while you edit it.",{"path":449,"title":450,"description":451,"section":430,"order":306},"\u002Fdocs\u002Frecording\u002Ftoolbar","The recorder toolbar","Name and start keywords, save, undo and discard them, end the session, and keep the toolbar out of the page's way.",{"path":453,"title":454,"description":455,"section":430,"order":353},"\u002Fdocs\u002Frecording\u002Fwhat-gets-recorded","What gets recorded","Which Browser keyword each action becomes, how popups, dialogs, downloads and uploads are handled, recording assertions, and the selectors the recorder writes.",{"path":457,"title":458,"description":459,"section":460,"order":306},"\u002Fdocs\u002Fstart\u002Fgetting-started","Getting started","Install Browser, write a first test, and run it.","start",{"path":462,"title":463,"description":464,"section":460,"order":318},"\u002Fdocs\u002Fstart\u002Finstallation","Installation","The two ways to install Browser — with a bundled Node.js runtime, or with one you provide yourself — and how to upgrade and remove each.",[466,469,472],{"to":467,"label":468},"\u002Fwhy\u002Fvs-cypress","vs Cypress",{"to":470,"label":471},"\u002Fwhy\u002Fvs-playwright","vs Playwright Test",{"to":473,"label":474},"\u002Fwhy\u002Fvs-seleniumlibrary","vs SeleniumLibrary",[476],"\u003Cspan class=\"line\">\u003Cspan>page traffic     the page loads, fetches, posts …  and HTTP\u003C\u002Fspan>\u003C\u002Fspan>\u003Cspan class=\"line\">\u003Cspan>                 Page ──▶ route rules ──▶ network ──▶ Server\u003C\u002Fspan>\u003C\u002Fspan>\u003Cspan class=\"line\">\u003Cspan>                   └── seen by Wait For Request \u002F Wait For Response\u003C\u002Fspan>\u003C\u002Fspan>\u003Cspan class=\"line\">\u003Cspan>\u003C\u002Fspan>\u003C\u002Fspan>\u003Cspan class=\"line\">\u003Cspan>API traffic      Send API Request\u003C\u002Fspan>\u003C\u002Fspan>\u003Cspan class=\"line\">\u003Cspan>                 Context ───────────────▶ network ──▶ Server\u003C\u002Fspan>\u003C\u002Fspan>",1795470907577]