Skip to content

Commit

Permalink
Update Page for typos and missing details
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Jun 20, 2024
1 parent 49a5fba commit ac396af
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
const text = await page.$('#text1');
await text.type('hello world');
const text = await page
.$('#text1')
.then(text => text.type('hello world'));
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Returns the `element.innerText`.

### Returns

| Type | Description |
| ----------------- | ----------------------------------------------------------- |
| `Promise<string>` | A Promise that fullfils with the inner text of the element. |
| Type | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `Promise<string>` | A Promise that fullfils with the inner text (represents the rendered text content of an element handle and its descendants) of the element. |

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
page.fill('#text1', 'Hello world!');
await page.fill('#text1', 'Hello world!');
const inputValue = await page.inputValue('#text1');
console.log(inputValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
console.log(page.opener());
console.log(await page.opener());
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
page.press('#text1', 'Tab');
await page.press('#text1', 'Tab');
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
page.reload();
await page.reload();
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
page.screenshot({ path: 'screenshots/browser.png' });
await page.screenshot({ path: 'screenshots/browser.png' });
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default async function () {
const page = await browser.newPage();

await page.goto('https://test.k6.io/browser.php');
page.selectOption('#numbers-options', 'three');
await page.selectOption('#numbers-options', 'three');
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default async function () {
</html>
`;

page.setContent(htmlContent);
await page.setContent(htmlContent);
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const options = {
export default async function () {
const page = await browser.newPage();

page.setExtraHTTPHeaders({ foo: 'bar' });
await page.setExtraHTTPHeaders({ foo: 'bar' });
const url = await page.goto('https://test.k6.io/browser.php');

console.log(url.request().headers().foo); // prints bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default async function () {
try {
// In this example we create a simple web page with an upload input field.
// Usually, you would use page.goto to navigate to a page with a file input field.
page.setContent(`
await page.setContent(`
<html>
<head></head>
<body>
Expand All @@ -66,13 +66,13 @@ export default async function () {
</html>`);

// The file is set to the input element with the id "upload".
page.setInputFiles('input[id="upload"]', {
await page.setInputFiles('input[id="upload"]', {
name: 'file.txt',
mimetype: 'text/plain',
buffer: encoding.b64encode('hello world'),
});
} finally {
page.close();
await page.close();
}
}
```
Expand Down Expand Up @@ -129,13 +129,13 @@ export default async function () {
const buffer = await readAll(file);

// The file is set to the input element with the id "upload".
page.setInputFiles({
await page.setInputFiles({
name: 'file.txt',
mimetype: 'text/plain',
buffer: encoding.b64encode(buffer),
});
} finally {
page.close();
await page.close();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const options = {
export default async function () {
const page = await browser.newPage();

page.setViewportSize({
await page.setViewportSize({
width: 640,
height: 480,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default async function () {
const page = await browser.newPage();

try {
page.evaluate(() => {
await page.evaluate(() => {
setTimeout(() => {
const el = document.createElement('h1');
el.innerHTML = 'Hello';
Expand Down

0 comments on commit ac396af

Please sign in to comment.