# K6 Browser Module

**URL:** <https://community.grafana.com/t/k6-browser-module/103569>\
**Category:** k6-browser\
**Created:** [September 14, 2023, 1:28pm UTC](https://community.grafana.com/t/k6-browser-module/103569 "2023-09-14T13:28:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pattelachinky](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@pattelachinky](https://community.grafana.com/u/pattelachinky)\
**Post date:** [September 14, 2023, 1:28pm UTC](https://community.grafana.com/t/k6-browser-module/103569/1 "2023-09-14T13:28:33Z")

</div>

Hi ,  
I am trying to run K6 on my machine and unable to run it as it is giving me error:

ERRO[0000] could not initialize ‘code.js’: could not load JS test ‘file:///C:/Users/ppraval6/Desktop/K6/bh\_mps\_k6/code.js’: file:///C:/Users/ppraval6/Desktop/K6/bh\_mps\_k6/code.js: Line 28:25 Unexpected token function (and 6 more errors)

I am using windows 10 OS and k6 v0.39.0 (2022-07-05T10:50:14+0000/v0.39.0-0-g5904fd8, go1.18.3, windows/amd64)

---

<div class="post-metadata">

**Author:** ![pattelachinky](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@pattelachinky](https://community.grafana.com/u/pattelachinky)\
**Post date:** [September 14, 2023, 1:29pm UTC](https://community.grafana.com/t/k6-browser-module/103569/2 "2023-09-14T13:29:13Z")

</div>

The code used to test is 🙂 import { browser } from ‘k6/experimental/browser’;  
import { check } from ‘k6’;

export const options = {  
scenarios: {  
ui: {  
executor: ‘shared-iterations’,  
options: {  
browser: {  
type: ‘chromium’,  
},  
},  
},  
},  
thresholds: {  
checks: [“rate==1.0”]  
}  
}

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

try {  
await page.goto(‘someurl’);

```
page.locator('input[name="login"]').type('admin');
page.locator('input[name="password"]').type('123');

const submitButton = page.locator('input[type="submit"]');

await Promise.all([page.waitForNavigation(), submitButton.click()]);

check(page, {
  'header': p => p.locator('h2').textContent() == 'Welcome, admin!',
});

```

} finally {  
page.close();  
}  
}

---

<div class="post-metadata">

**Author:** ![inancgumus](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/inancgumus/32/34670_2.png) [@inancgumus](https://community.grafana.com/u/inancgumus)\
**Post date:** [September 18, 2023, 8:05am UTC](https://community.grafana.com/t/k6-browser-module/103569/3 "2023-09-18T08:05:47Z")

</div>

Hi @pattelachinky,

Please make sure you’re using these quotes: **"** and **'**. Instead of **‘** , **“** , **”**.

Thanks.
