<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Request on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/</link><description>Recent content in Request on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/javascript-api/k6-browser/request/index.xml" rel="self" type="application/rss+xml"/><item><title>allHeaders()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/allheaders/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/allheaders/</guid><content><![CDATA[&lt;h1 id=&#34;allheaders&#34;&gt;allHeaders()&lt;/h1&gt;
&lt;p&gt;An object of key value pairs made up of HTTP headers associated with the request and the ones that the browser adds (such as cookies). All header names are lower-case.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Promise&amp;lt;Record&amp;lt;string, string&amp;gt;&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A promise that resolves to an object of key value pairs for each header.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const allHeaders = await req.allHeaders();
    console.log(`allHeaders: ${JSON.stringify(allHeaders)}`); // allHeaders: {&amp;#34;user-agent&amp;#34;:&amp;#34;Mozilla/5.0...}
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="allheaders">allHeaders()&lt;/h1>
&lt;p>An object of key value pairs made up of HTTP headers associated with the request and the ones that the browser adds (such as cookies). All header names are lower-case.&lt;/p></description></item><item><title>frame()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/frame/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/frame/</guid><content><![CDATA[&lt;h1 id=&#34;frame&#34;&gt;frame()&lt;/h1&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/k6-browser/frame/&#34;&gt;Frame&lt;/a&gt; that initiated the request.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/k6-browser/frame/&#34;&gt;Frame&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;code&gt;Frame&lt;/code&gt; that initiated the request.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const frame = req.frame();
    // ...
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="frame">frame()&lt;/h1>
&lt;p>The
&lt;a href="/docs/k6/v2.3.x/javascript-api/k6-browser/frame/">Frame&lt;/a> that initiated the request.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>
&lt;a href="/docs/k6/v2.3.x/javascript-api/k6-browser/frame/">Frame&lt;/a>&lt;/td>
&lt;td>The &lt;code>Frame&lt;/code> that initiated the request.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const frame = req.frame();
// ...
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>headers()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headers/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headers/</guid><content><![CDATA[&lt;h1 id=&#34;headers&#34;&gt;headers()&lt;/h1&gt;
&lt;p&gt;An object of key value pairs made up of HTTP headers associated with the request.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Record&amp;lt;string, string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Key value pairs for each header.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const headers = req.headers();
    console.log(`headers: ${JSON.stringify(headers)}`); // headers: {&amp;#34;user-agent&amp;#34;:&amp;#34;Mozilla/5.0...}
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="headers">headers()&lt;/h1>
&lt;p>An object of key value pairs made up of HTTP headers associated with the request.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>Record&amp;lt;string, string&amp;gt;&lt;/code>&lt;/td>
&lt;td>Key value pairs for each header.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const headers = req.headers();
console.log(`headers: ${JSON.stringify(headers)}`); // headers: {&amp;#34;user-agent&amp;#34;:&amp;#34;Mozilla/5.0...}
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>headersArray()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headersarray/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headersarray/</guid><content><![CDATA[&lt;h1 id=&#34;headersarray&#34;&gt;headersArray()&lt;/h1&gt;
&lt;p&gt;An array with all the request HTTP headers. Unlike 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/k6-browser/request/allheaders/&#34;&gt;request.allHeaders()&lt;/a&gt;, header names are not lower-cased. Headers with multiple entries, such as &lt;code&gt;Set-Cookie&lt;/code&gt;, appear in the array multiple times.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Promise&amp;lt;Array&amp;lt;{ name: string; value: string }&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A promise that resolves to an array of all the request HTTP headers.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const headersArray = await req.headersArray();
    console.log(`headersArray: ${JSON.stringify(headersArray)}`); // headersArray: [{&amp;#34;name&amp;#34;:&amp;#34;Accept-Language&amp;#34;,&amp;#34;value&amp;#34;...}]
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="headersarray">headersArray()&lt;/h1>
&lt;p>An array with all the request HTTP headers. Unlike
&lt;a href="/docs/k6/v2.3.x/javascript-api/k6-browser/request/allheaders/">request.allHeaders()&lt;/a>, header names are not lower-cased. Headers with multiple entries, such as &lt;code>Set-Cookie&lt;/code>, appear in the array multiple times.&lt;/p></description></item><item><title>headerValue(name)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headervalue/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/headervalue/</guid><content><![CDATA[&lt;h1 id=&#34;headervaluename&#34;&gt;headerValue(name)&lt;/h1&gt;
&lt;p&gt;Returns the value of the header matching the name. The name is case insensitive.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Promise&amp;lt;string | null&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A promise that resolves to the value of the header matching the name, otherwise &lt;code&gt;null&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const headerValue = await req.headerValue(&amp;#39;accept-language&amp;#39;);
    console.log(`headerValue: ${headerValue}`); // headerValue: en-US
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="headervaluename">headerValue(name)&lt;/h1>
&lt;p>Returns the value of the header matching the name. The name is case insensitive.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>Promise&amp;lt;string | null&amp;gt;&lt;/code>&lt;/td>
&lt;td>A promise that resolves to the value of the header matching the name, otherwise &lt;code>null&lt;/code>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const headerValue = await req.headerValue(&amp;#39;accept-language&amp;#39;);
console.log(`headerValue: ${headerValue}`); // headerValue: en-US
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>isNavigationRequest()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/isnavigationrequest/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/isnavigationrequest/</guid><content><![CDATA[&lt;h1 id=&#34;isnavigationrequest&#34;&gt;isNavigationRequest()&lt;/h1&gt;
&lt;p&gt;Returns a boolean stating whether the request is for a navigation.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;boolean&lt;/td&gt;
              &lt;td&gt;Boolean stating whether the request is for a navigation.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const isNavReq = req.isNavigationRequest();
    console.log(`isNavReq: ${isNavReq}`); // isNavReq: true
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="isnavigationrequest">isNavigationRequest()&lt;/h1>
&lt;p>Returns a boolean stating whether the request is for a navigation.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>boolean&lt;/td>
&lt;td>Boolean stating whether the request is for a navigation.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const isNavReq = req.isNavigationRequest();
console.log(`isNavReq: ${isNavReq}`); // isNavReq: true
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>method()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/method/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/method/</guid><content><![CDATA[&lt;h1 id=&#34;method&#34;&gt;method()&lt;/h1&gt;
&lt;p&gt;Request&amp;rsquo;s method (GET, POST, etc.).&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;string&lt;/td&gt;
              &lt;td&gt;Request&amp;rsquo;s method name.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const method = req.method();
    console.log(`method: ${method}`); // method: GET
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="method">method()&lt;/h1>
&lt;p>Request&amp;rsquo;s method (GET, POST, etc.).&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>string&lt;/td>
&lt;td>Request&amp;rsquo;s method name.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const method = req.method();
console.log(`method: ${method}`); // method: GET
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>postData()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/postdata/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/postdata/</guid><content><![CDATA[&lt;h1 id=&#34;postdata&#34;&gt;postData()&lt;/h1&gt;
&lt;p&gt;Contains the request&amp;rsquo;s post body, if any.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;string | null&lt;/td&gt;
              &lt;td&gt;Request&amp;rsquo;s post body, otherwise &lt;code&gt;null&lt;/code&gt; if none exists.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const postData = req.postData();
    console.log(`postData: ${postData}`); // postData: null
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="postdata">postData()&lt;/h1>
&lt;p>Contains the request&amp;rsquo;s post body, if any.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>string | null&lt;/td>
&lt;td>Request&amp;rsquo;s post body, otherwise &lt;code>null&lt;/code> if none exists.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const postData = req.postData();
console.log(`postData: ${postData}`); // postData: null
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>postDataBuffer()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/postdatabuffer/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/postdatabuffer/</guid><content><![CDATA[&lt;h1 id=&#34;postdatabuffer&#34;&gt;postDataBuffer()&lt;/h1&gt;
&lt;p&gt;Request&amp;rsquo;s post body in a binary form, if any.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;ArrayBuffer | null&lt;/td&gt;
              &lt;td&gt;Returns an &lt;code&gt;ArrayBuffer&lt;/code&gt; with request&amp;rsquo;s post data or &lt;code&gt;null&lt;/code&gt; if no post data.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const postDataBuffer = req.postDataBuffer();
    console.log(`postDataBuffer: ${postDataBuffer}`); // postDataBuffer: null
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="postdatabuffer">postDataBuffer()&lt;/h1>
&lt;p>Request&amp;rsquo;s post body in a binary form, if any.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>ArrayBuffer | null&lt;/td>
&lt;td>Returns an &lt;code>ArrayBuffer&lt;/code> with request&amp;rsquo;s post data or &lt;code>null&lt;/code> if no post data.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const postDataBuffer = req.postDataBuffer();
console.log(`postDataBuffer: ${postDataBuffer}`); // postDataBuffer: null
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>resourceType()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/resourcetype/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/resourcetype/</guid><content><![CDATA[&lt;h1 id=&#34;resourcetype&#34;&gt;resourceType()&lt;/h1&gt;
&lt;p&gt;Contains the request&amp;rsquo;s resource type as it was perceived by the rendering engine. It will be one of the following: &lt;code&gt;document&lt;/code&gt;, &lt;code&gt;stylesheet&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, &lt;code&gt;media&lt;/code&gt;, &lt;code&gt;font&lt;/code&gt;, &lt;code&gt;script&lt;/code&gt;, &lt;code&gt;texttrack&lt;/code&gt;, &lt;code&gt;xhr&lt;/code&gt;, &lt;code&gt;fetch&lt;/code&gt;, &lt;code&gt;eventsource&lt;/code&gt;, &lt;code&gt;websocket&lt;/code&gt;, &lt;code&gt;manifest&lt;/code&gt;, &lt;code&gt;other&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;string&lt;/td&gt;
              &lt;td&gt;Resource type name.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const resourceType = req.resourceType();
    console.log(`resourceType: ${resourceType}`); // resourceType: Document
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="resourcetype">resourceType()&lt;/h1>
&lt;p>Contains the request&amp;rsquo;s resource type as it was perceived by the rendering engine. It will be one of the following: &lt;code>document&lt;/code>, &lt;code>stylesheet&lt;/code>, &lt;code>image&lt;/code>, &lt;code>media&lt;/code>, &lt;code>font&lt;/code>, &lt;code>script&lt;/code>, &lt;code>texttrack&lt;/code>, &lt;code>xhr&lt;/code>, &lt;code>fetch&lt;/code>, &lt;code>eventsource&lt;/code>, &lt;code>websocket&lt;/code>, &lt;code>manifest&lt;/code>, &lt;code>other&lt;/code>.&lt;/p></description></item><item><title>response()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/response/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/response/</guid><content><![CDATA[&lt;h1 id=&#34;response&#34;&gt;response()&lt;/h1&gt;
&lt;p&gt;Returns the matching 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/k6-browser/response/&#34;&gt;Response&lt;/a&gt; object, or &lt;code&gt;null&lt;/code&gt; if the response was not received due to error.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Promise&amp;lt;Response | null&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;code&gt;Response&lt;/code&gt; object, or &lt;code&gt;null&lt;/code&gt; if the response was not received due to error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const response = await req.response();
    // ...
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="response">response()&lt;/h1>
&lt;p>Returns the matching
&lt;a href="/docs/k6/v2.3.x/javascript-api/k6-browser/response/">Response&lt;/a> object, or &lt;code>null&lt;/code> if the response was not received due to error.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>Promise&amp;lt;Response | null&amp;gt;&lt;/code>&lt;/td>
&lt;td>The &lt;code>Response&lt;/code> object, or &lt;code>null&lt;/code> if the response was not received due to error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const response = await req.response();
// ...
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>size()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/size/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/size/</guid><content><![CDATA[&lt;h1 id=&#34;size&#34;&gt;size()&lt;/h1&gt;
&lt;p&gt;This method returns the size (in bytes) of body and header sections of the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/k6-browser/request/&#34;&gt;Request&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Promise&lt;Size&gt;&lt;/td&gt;
              &lt;td&gt;Returns &lt;a href=&#34;#size&#34;&gt;Size&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;size-1&#34;&gt;Size&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Property&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;body&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Size in bytes of the request body.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;headers&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Size in bytes of the headers body.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const size = req.size();
    console.log(`size: ${JSON.stringify(size)}`); // size: {&amp;#34;headers&amp;#34;:344,&amp;#34;body&amp;#34;:0}
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="size">size()&lt;/h1>
&lt;p>This method returns the size (in bytes) of body and header sections of the
&lt;a href="/docs/k6/v2.3.x/javascript-api/k6-browser/request/">Request&lt;/a>.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Promise&lt;Size>&lt;/td>
&lt;td>Returns &lt;a href="#size">Size&lt;/a>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="size-1">Size&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Property&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>body&lt;/td>
&lt;td>number&lt;/td>
&lt;td>Size in bytes of the request body.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>headers&lt;/td>
&lt;td>number&lt;/td>
&lt;td>Size in bytes of the headers body.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const size = req.size();
console.log(`size: ${JSON.stringify(size)}`); // size: {&amp;#34;headers&amp;#34;:344,&amp;#34;body&amp;#34;:0}
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>timing()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/timing/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/timing/</guid><content><![CDATA[&lt;h1 id=&#34;timing&#34;&gt;timing()&lt;/h1&gt;
&lt;p&gt;Returns resource timing information for the given request. Most of the timing values become available upon the response, &lt;code&gt;responseEnd&lt;/code&gt; becomes available when request finishes.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;ResourceTiming&lt;/td&gt;
              &lt;td&gt;Returns &lt;a href=&#34;#resourcetiming&#34;&gt;ResourceTiming&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;resourcetiming&#34;&gt;ResourceTiming&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Property&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;statTime&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;domainLookupStart&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;domainLookupEnd&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately after the browser ends the domain name lookup for the resource. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;connectStart&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;secureConnectionStart&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately before the browser starts the handshake process to secure the current connection. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;connectEnd&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately after the user agent establishes the connection to the server to retrieve the resource. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;requestStart&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;responseStart&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately after the browser receives the first byte of the response from the server, cache, or local resource. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;responseEnd&lt;/td&gt;
              &lt;td&gt;number&lt;/td&gt;
              &lt;td&gt;Time immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. The value is given in milliseconds relative to &lt;code&gt;startTime&lt;/code&gt;, -1 if not available.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const timing = await req.timing();
    console.log(`timing: ${JSON.stringify(timing)}`); // timing: {&amp;#34;startTime&amp;#34;:534898988.85297775,...}
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="timing">timing()&lt;/h1>
&lt;p>Returns resource timing information for the given request. Most of the timing values become available upon the response, &lt;code>responseEnd&lt;/code> becomes available when request finishes.&lt;/p></description></item><item><title>url()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/url/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-browser/request/url/</guid><content><![CDATA[&lt;h1 id=&#34;url&#34;&gt;url()&lt;/h1&gt;
&lt;p&gt;URL of the request.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;string&lt;/td&gt;
              &lt;td&gt;URL of the request.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { browser } from &amp;#39;k6/browser&amp;#39;;

export const options = {
  scenarios: {
    ui: {
      executor: &amp;#39;shared-iterations&amp;#39;,
      options: {
        browser: {
          type: &amp;#39;chromium&amp;#39;,
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
    const req = res.request();

    const url = await req.url();
    console.log(`url: ${url}`); // url: https://test.k6.io/
  } finally {
    await page.close();
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="url">url()&lt;/h1>
&lt;p>URL of the request.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>string&lt;/td>
&lt;td>URL of the request.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import { browser } from &amp;#39;k6/browser&amp;#39;;
export const options = {
scenarios: {
ui: {
executor: &amp;#39;shared-iterations&amp;#39;,
options: {
browser: {
type: &amp;#39;chromium&amp;#39;,
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto(&amp;#39;https://test.k6.io/&amp;#39;);
const req = res.request();
const url = await req.url();
console.log(`url: ${url}`); // url: https://test.k6.io/
} finally {
await page.close();
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item></channel></rss>