-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py][bidi]: add downloadEnd
event for browsing context
#16209
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
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
LGTM - once you’ve got a test or 2 for this I think you’re good to go |
Current stable browsers are not supporting this event, so can't test it :( |
Hm, that’s an interesting case then. We might want to put this pr on hold… what do y’all think @cgoldberg @diemol ? |
hmm... that's a tough call. If we release it now, it's not fully tested and not usable by most people... which might cause confusion. If we wait for Chrome/Edge/Firefox to all support it in stable versions, it's safer but we are late to the party and might be holding back useful functionality for a subset of users. I think either way has a valid argument, so I'm not sure :) Whatever we decide, we should make it a project policy for timing the release of new BiDi functionality. Have other bindings hit this issue? |
Dotnet adds some new events without tests (like #15916), there are some events in Java which don't have tests - |
I think we can add this, and perhaps write in the equivalent of JavaDocs for Python that this is supported on X version of the browser. Otherwise this PR might become stale, like many others we have. |
I more meant the issue of releasing features that all browsers don't yet support in stable versions. I like the idea from @diemol of just adding a note in docstrings that it requires the browser to support this. My only concern is how nicely this fails when run on a browser that doesn't support it. Do we give some cryptic error? Other than that, this seems fine to ship. |
My biggest concern would be that we don’t know if this code truly works (though I’m sure it does, @navin772 is awesome) until at least one browser supports it - I am uncomfortable w/ the precedent of merging untested code. |
Chrome 140 supports this (next stable version) and there is no info regarding edge and firefox, they are currently failing the WPT tests. What should the docstring include in this case?
@shbenzer This is a valid concern, I just tested this code against Chrome 140 which is currently in beta and it works as expected. We recently started testing python tests against chrome beta in CI-RBE so this test should pass there too. But the issue will be that we need to selectively skip the chrome stable test in CI (so CI stays green) for which we don't have a xfail marker as of now. Should we add it? Is this a better approach or just wait for 140 to release? |
I think we should add something vague in a module-level docstring about BiDi functionality only working in supported browsers. I don't think we should get into detail there about which browsers and versions currently work with each feature, or do this for every method. We don't want to constantly update the individual docstrings and keep an internal version of BiDi feature support. Maybe all of the BiDi modules should have a similar docstring. I think more important is the behavior and error message when someone tries to use some BiDi functionality on a browser that doesn't support it. It would be nice to fail with an error like "sorry, your browser doesn't support this yet" instead of some cryptic exception (I don't know what currently happens). |
We get a pretty good error message from the browser which we pass on to the user's stdout. For example, firefox throws this error:
But chrome isn't throwing any error and would fail when no event is received. Should we modify this behaviour? |
We could append to it w/ some clarifying details |
My 50 cents: Selenium should not wait until all vendors implement BiDi spec. We can implement the specification in advance. But the question is are we sure we implement it correctly? My personal plan in .NET area is easy: implement method/event, add small subset of tests which works at least with one browser, we are happy - release to end users. Mentioning something in DocStrings is not necessary, because browser can be updated at some time with supporting of new method/event, thus DoCStrings become invalid. Note: Users might easily request to use |
That's why I recommended not mentioning specific browsers or versions. I think a note in doctrings that says "some of these classes/methods may not be supported yet in all browsers" is useful until BiDi is fully supported... Users will see it in the API documentation. |
It is good to mention it globally, not for particular method/event. |
In Python we have module docstrings, which is where I suggested it go. |
@cgoldberg where should I put the docstring? Should it be at the top of the |
I just looked at the API docs and noticed module level docstrings show up in the Table of Contents next to each module name, so we probably can't put a big block of text. I guess we should hold off on adding this until we figure out a good place. That shouldn't hold up this PR. |
User description
🔗 Related Issues
💥 What does this PR do?
Adds support for the
downloadEnd
event in bidi browsing context module - https://w3c.github.io/webdriver-bidi/#event-browsingContext-downloadEnd🔧 Implementation Notes
💡 Additional Considerations
DownloadWillBeginParams
'sfrom_json
method to be better as done for other Download classes.🔄 Types of changes
PR Type
Enhancement
Description
Add
downloadEnd
event support for BiDi browsing contextImplement
DownloadCanceledParams
andDownloadCompleteParams
classesRefactor
DownloadWillBeginParams.from_json
method for consistencyRegister new event in BrowsingContext EVENT_CONFIGS
Diagram Walkthrough
File Walkthrough
browsing_context.py
Add downloadEnd event classes and BiDi integration
py/selenium/webdriver/common/bidi/browsing_context.py
DownloadCanceledParams
andDownloadCompleteParams
classesDownloadEndParams
wrapper class with status-based factoryDownloadEnd
event class for BiDi integrationDownloadWillBeginParams.from_json
to useNavigationInfo.from_json