Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookies: Clearing cookies fails #442

Closed
ankur22 opened this issue Jul 7, 2022 · 0 comments · Fixed by #1040
Closed

Cookies: Clearing cookies fails #442

ankur22 opened this issue Jul 7, 2022 · 0 comments · Fixed by #1040
Assignees
Labels
bug Something isn't working cookies

Comments

@ankur22
Copy link
Collaborator

ankur22 commented Jul 7, 2022

Tested against: dbede12

When ClearCookies is called on BrowserContext it panics and fails to clear the cookies ending with the following error:

unable to clear cookies permissions: invalid context

The javascript test used was:

import { sleep } from 'k6';
import launcher from 'k6/x/browser';

export default function () {
  const browser = launcher.launch('chromium', {
      headless: false,
  });
  const context = browser.newContext();
  const page = context.newPage();
  const res = page.goto('https://test.k6.io/browser.php');
  context.clearCookies();

  sleep(10);
  browser.close();
}

The expected result is that it clears the cookies for all pages that were opened from the relevant context.

The Playwright test code is:

// @ts-check
const { test, chromium } = require('@playwright/test');

test.describe('Editing', () => {
  test('Type login creds', async () => {
    const browser = await chromium.launch({ headless: false, slowMo: 500 });
    const ctx = await browser.newContext();
    const page = await ctx.newPage();
    await page.goto('https://test.k6.io/browser.php');
    await ctx.clearCookies();

    await new Promise(resolve => setTimeout(resolve, 10000));

    await browser.close();
  });
});
@ankur22 ankur22 added the bug Something isn't working label Jul 7, 2022
@inancgumus inancgumus self-assigned this Aug 22, 2023
@inancgumus inancgumus changed the title Panics and fails to clearCookies on BrowserContext Fail to clear cookies Sep 19, 2023
@inancgumus inancgumus changed the title Fail to clear cookies Fails to clear cookies Sep 19, 2023
@inancgumus inancgumus changed the title Fails to clear cookies Cookies: clearCookies doesn't work Sep 19, 2023
@inancgumus inancgumus changed the title Cookies: clearCookies doesn't work Cookies: Clearing cookies fails Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cookies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants