You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's see how confident we are about BiDi API. In general I like the applied approach, but with some concerns.
driver.AsBiDiAsync() extension method should be finally live in AnyDriver class. Thus AnyDriver object is an owner of the BiDi instance, and dispose BiDi as soon as owner is disposed. Not sure, but I think IWebDriver interface is a great candidate to have this new AsBiDiAsync() method.
It is important. Finally we will have straightforward dependency: Selenium.Webdriver -> Selenium.WebDriver.BiDi.
Revisit InterceptRequestAsync() method (and neighbors: response, auth). This method(s) provides more convenient API to intercept network. Literally saying it should be extensions built on top of already publicly available methods.
UPD: .NET 10 provides new extensions capabilities, where we can create properties. Amazing, so the decision here would be move all helpers/extensions to dedicated namespace.
RESOLUTION: Removed them at all to be low-level, extension methods are still in mind.
. It is useful definitely, but seems it is overkill. We can create extensions, like .GetTreeAsync().AsContexts(). In any case I propose to remove IReadOnlyList<T>, and more important remove strange json converters for these types. - [dotnet] [bidi] Remove IEnumerable of command results #16219
Commands should return Result instead of one object of this Result. Example: SetCookieAsync return Task<PartitionKey> instead of Task<SetCookieResult>. Review all commands and return exact type. - [dotnet] [bidi] Specific result type for any command #16405
Command options should be immutable? Like when I do await bidi.DoSomethingAsync(new DoSomethingOptions(...)) then DoSomethingOptions object should be constructed once and I should not be able to change its state. - Internally we capture command options into immutable object, it is safe that user might change his own options. It is still not safe, we can use records with {get;init;}. - [dotnet] [bidi] Fully immutable commands and events #17077
Remove stateful json converters (who is dependent on bidi object)! There is no big benefit. - We nicely resolved it technically, still exposing BiDi instance for extensibility, and still perfectly AOT trimming friendly. [dotnet] [bidi] Stateful converters with hydration #16670
Extensible command/result/event (2 levels of extensibility: root json object and params object)
IReadOnly vs IEnumerable. Currently we accept IEnumerable as incoming interface, meaning we can fail with Collection was modified during serialization. This is only one interface for commands execution which is not truly safe. Better way is to accept materialized collections. This is still convenient for users, I believe.
Anything else?..
Have you considered any alternatives or workarounds?
This issue is for tracking possible big changes in the approach. As soon as we resolve all of them, then we are confident with the approach and can move further (like documenting and fine tuning).
Description
Let's see how confident we are about BiDi API. In general I like the applied approach, but with some concerns.
driver.AsBiDiAsync()extension method should be finally live inAnyDriverclass. ThusAnyDriverobject is an owner of theBiDiinstance, and disposeBiDias soon as owner is disposed. Not sure, but I thinkIWebDriverinterface is a great candidate to have this newAsBiDiAsync()method.It is important. Finally we will have straightforward dependency:
Selenium.Webdriver->Selenium.WebDriver.BiDi.AddIntercept(). So just make itpublicinstead ofinternal, that's it. [🚀 Feature]: [dotnet] [bidi] Expose BiDi to be truly public low-level API #15612InterceptRequestAsync()method (and neighbors: response, auth). This method(s) provides more convenient API to intercept network. Literally saying it should be extensions built on top of already publicly available methods.UPD: .NET 10 provides new extensions capabilities, where we can create properties. Amazing, so the decision here would be move all helpers/extensions to dedicated namespace.
RESOLUTION: Removed them at all to be low-level, extension methods are still in mind.
EmptyResultshould be valid return type for all methods instead ofvoid. [🚀 Feature]: [dotnet] [bidi] IntroduceEmptyResultas a type #15562*EventArgs, and construct it from spec defined type (includingIBiDihydration!) [dotnet] [bidi] Revise event args #17304Resultclass implementsIReadOnlyList<T>-selenium/dotnet/src/webdriver/BiDi/BrowsingContext/GetTreeCommand.cs
Line 50 in 55f02a9
extensions, like.GetTreeAsync().AsContexts(). In any case I propose to removeIReadOnlyList<T>, and more important remove strange json converters for these types. - [dotnet] [bidi] Remove IEnumerable of command results #16219Resultinstead of one object of thisResult. Example:SetCookieAsyncreturnTask<PartitionKey>instead ofTask<SetCookieResult>. Review all commands and return exact type. - [dotnet] [bidi] Specific result type for any command #16405await bidi.DoSomethingAsync(new DoSomethingOptions(...))thenDoSomethingOptionsobject should be constructed once and I should not be able to change its state. -Internally we capture command options into immutable object, it is safe that user might change his own options.It is still not safe, we can use records with{get;init;}. - [dotnet] [bidi] Fully immutable commands and events #17077BiDiinstance for extensibility, and still perfectly AOT trimming friendly. [dotnet] [bidi] Stateful converters with hydration #16670IBiDi/IBrowserModule? What benefits, testability?netstandard2.0/net462target.. History: [dotnet] [bidi] Earlier preview feedback gathering #14530.UPD: Seems
unionssemantically will be withoutjson discriminator, fuh. So, continue using polymorphic types, just handle this special case manually.IReadOnlyvsIEnumerable. Currently we acceptIEnumerableas incoming interface, meaning we can fail withCollection was modifiedduring serialization. This is only one interface for commands execution which is not truly safe. Better way is to accept materialized collections. This is still convenient for users, I believe.Have you considered any alternatives or workarounds?
This issue is for tracking possible big changes in the approach. As soon as we resolve all of them, then we are confident with the approach and can move further (like documenting and fine tuning).