All options have been expanded in call sites?
See original GitHub issueHi there, just a quick question for you, I just updated the PlaywrightSharp nuget package to latest version and read the September report in which I saw there were breaking changes to the way we initialize the browser.
In the text after, it is said the the rest of the code should not have to be updated to work with the newer package, but in my case it breaks in multiple places… I would like to know if it’s normal or if I did something wrong here…
For example, I was usually calling page.GoToAsync
in the following way:
await page.GoToAsync(url, new GoToOptions
{
WaitUntil = new WaitUntilNavigation[] { WaitUntilNavigation.Load }
});
but that doesn’t seem to work anymore, it seems like the GoToOptions
have been expanded so that we need to put them directly at call site like so:
await page.GoToAsync(url, LifecycleEvent.Load);
In this specific case, the call site is clearer and more concise which is really nice, but in other cases(for example when calling GetPdfAsync
, the call has to explicitely specify each option while before I could simply pass the options object.
In my use case, I usually passed the PdfOptions
around in my own api and only passed this object to the final function performing the actual conversion, which made it cleaner compared to now where I need to pass each option individually to each call. For now I copied the previous PdfOptions
in my local code and I expand it to the final call but I was wondering if I did something wrong or not due to the note on the blog post saying that no other code would need to be updated…
Thanks in advance!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Sure sorry I should have done it yesterday
First, thank you for being an early user @lvmajor. As you may know, being in the v0 stage gives us the liberty to shape the API before reaching v1. Sorry to break your code 🤓
This is a product decision coming from the Playwright team. The idea is having the same philosophy across bindings. We don’t see the use of getting these options in the long term (except for the launch options for settings). As you saw, it looks prettier.
On the other hand, we have extensions methods in C#. That gives the user the extensibility to create an extension method with an option class if they want to.
That being said, if you have a use case scenario where you say that an option class would be helpful, please don’t hesitate to share it.