teodesian/playwright-perl

Can't locate object method "select" via package "Playwright::ElementHandle"

Closed this issue · 9 comments

Oops, this error shouldn't happen.

Here's a little test script to reproduce the error.

hmm, here's hoping the map of $ and $$ from playwright didn't get mucked up somehow. I'll look tomorrow morning.

quick ask -- playwright version (from npm) installed?

$ npx playwright -V
Version 1.12.3
$ cpan-outdated | grep Playwright
T/TE/TEODESIAN/Playwright-0.009.tar.gz

can reproduce. I then notice this case is not in my example which I use to test. of course this is where the bugs lie. This usage is also in my synopsis, making it clear this should? be supported. I'll have to check the spec if this is supported upstream (I think this is why I put it in synopsis), but if not I can probably shove it in there now that the parent page is an attribute of the element.

Yes, it's supported upstream: elementHandle.$(selector).

The parent page handle isn't needed for this (it's needed to run js code from an element handle).

curiously, the api spec as generated by playwright's own generateApiJson.js renders this as querySelector and querySelectorAll now, which is divergent from their official documentation.

This explains the failure. I'll have to map those names as well.

Yep, that fixed it.

The only other thing to mention is that it choked on your example selector because it was not prepended with xpath=, as suggested in the selector documentation for playwright.

it was not prepended with xpath=

I left that out by mistake.

Yep, that fixed it.

Nice!

I've sent it up to CPAN, it should get indexed before tonight. Thanks as always for the reports.