-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dotnet] [bidi] Earlier preview feedback gathering #14530
Comments
@nvborisenko, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Wanted to get hands on the new BiDi interface, but struggled due to the lack of documentation starting from getting the BiDi object: when should driver.AsBiDiAsync() and driver.AsBidiContextAsync() be used? Would be great to have similar samples to those that already exist for CDP I understand that it might sound more like complaint rather than a feedback, but it's safe to assume I won't be the only one who will have similar questions when tinkering with BiDI |
Sorry for that, it even may a subject for change. This is why we are collecting any feedback. Returning back to the question: driver.AsBiDiAsync(); // returns an object who is on top of all "tabs" driver.AsBidiContextAsync(); // returns the current "tab" We are still lack of documentation, construction of API is a priority. And then docs will be in place. |
Feature and motivation
Here we are going to gather everything related to BiDi implementation in .NET and improve it as soon as possible despite on any potential breaking changes.
1. Discriminated unions
We have a lot of classes what are inherited from a base. The basic example:
ClipRecatange
is used like:And it is not clear what exactly I can put as arguments. I see base class as an argument, but I don't see what available options I can provide. We can add factory:
But it requires to write so many boilerplate code from selenium team. Don't forget about optional parameters (which requires new class definition). So many code.
Solution
Use nested classes for all discriminated classes.
So user will be able to:
For user it seems there is no big diff, but for selenium team it is HUGE diff. And when https://github.com/dotnet/csharplang/blob/main/proposals/TypeUnions.md will be in place, it will everybody make happy: selenium team to write even less code, and user probably will write:
var screenshot = await context.CaptureScreenshotAsync(new Box(5, 5, 10, 10));
2. Don't mimic
BiDi
instance asBrowsingContext
We have helper methods in
BiDi
class which actually forward toBrowsingContext
module.Example:
Stop doing it and just expose modules. So it would be better:
3. Result object as Enumerable
Some commands return result, which seems to be a list of items.
Where
result
is:So
result
isGetCookiesResult
class, and it would be great if it behaves as enumerable.Solution
Implement
IReadOnlyList<T>
. So user is able to:And it will be also good to rename
result
class toCookiesList
(orCookiesReadOnlyList
orCookiesCollection
?)The text was updated successfully, but these errors were encountered: