Skip to content

Commit

Permalink
Update pageon JS example
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Jun 4, 2024
1 parent 30f9300 commit 8f6bb8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Binary file added example-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions examples/pageon.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ export default async function() {
try {
await page.goto('https://test.k6.io/');

page.on('console', msg => {
page.on('console', async(msg) => {
const jsonValue1 = await msg.args()[0].jsonValue();
const jsonValue2 = await msg.args()[1].jsonValue();
check(msg, {
'assertConsoleMessageType': msg => msg.type() == 'log',
'assertConsoleMessageText': msg => msg.text() == 'this is a console.log message 42',
'assertConsoleMessageArgs0': msg => msg.args()[0].jsonValue() == 'this is a console.log message',
'assertConsoleMessageArgs1': msg => msg.args()[1].jsonValue() == 42,
'assertConsoleMessageArgs0': msg => jsonValue1 == 'this is a console.log message',
'assertConsoleMessageArgs1': msg => jsonValue2 == 42,
});
});

Expand Down

0 comments on commit 8f6bb8d

Please sign in to comment.