Skip to content

[REGRESSION]: Unclear error message when undefined is passed to page.click() #1735

@dialupdev

Description

@dialupdev

Context:

  • GOOD Playwright Version: 0.12.1
  • BAD Playwright Version: 0.13.0
  • Operating System: macOS

Code Snippet

const { chromium } = require('playwright-chromium');

(async () => {
  const browser = await chromium.launch({ headless: false });
  const page = await browser.newPage();
  
  const myObject = {};
  await page.goto('https://www.google.com', { waitUntil: 'networkidle0' });
  await page.click(myObject.undefinedProperty);

  await browser.close();
})();

Describe the bug

Hi team. Thanks for all the great work on 0.13.0! It's looking really good. I did find one small regression in the error messaging.

0.12.1 gives me this:

TimeoutError: waiting for selector "undefined" failed: timeout 30000ms exceeded

0.13.0 gives me this:

TypeError: Cannot read property 'length' of undefined

It's a bit hard to understand what that means. To be clear I don't actually think 0.12.1 is truly "good" in this case either since I think it makes sense to fail fast when a nullish value is passed.

Thanks for taking a look!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions