microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[Bug]: WaitForSelectorAsync("selector", WaitForSelectorState) not working #1654

Closed kenjfz closed 3 years ago

kenjfz commented 3 years ago

Playwright version

Version 1.13.0-1626733671000

Operating system

Windows

What browsers are you seeing the problem on?

Chromium

Other information

.net 6 preview6

What happened? / Describe the bug

Below code won't work: await page.WaitForSelectorAsync("#search", WaitForSelectorState.Attached); Because the second parameter is set as PageWaitForSelectorOptions.

Code snippet to reproduce your bug

...
await page.WaitForSelectorAsync("#search", WaitForSelectorState.Attached);
...

Relevant log output

parameter 2: unable to transform "Microsoft.Playwright.WaitForSelectorState" as "Microsoft.Playwright.PageWaitForSelectorOptions?"
avodovnik commented 3 years ago

Yes, this is by design. You should be using

await page.WaitForSelectorAsync("#search", new() { State = WaitForSelectorState.Attached });

Just to clarify, does your code actually compile? Because it shouldn't, AFAIK.

kenjfz commented 3 years ago

Yes, this is by design. You should be using

await page.WaitForSelectorAsync("#search", new() { State = WaitForSelectorState.Attached });

Just to clarify, does your code actually compile? Because it shouldn't, AFAIK.

Your code works! Of course the previous one did't work/compile. I just followed the docs guidelines(https://playwright.dev/dotnet/docs/core-concepts#auto-waiting). Thanks!

avodovnik commented 3 years ago

Thanks for pointing that out! I've opened a PR to address that.