[dotnet] Add examples for BiDi W3C Browsing Context
User description
Examples for https://www.selenium.dev/documentation/webdriver/bidi/w3c/browsing_context/
TODO:
- [x] Finish examples
- [ ] Add references in code blocks for C#
- [ ] Reference stable version in csproj when v4.25 is released
- [ ] Create new base fixture for all bidi tests
Types of changes
- [ ] Change to the site (I have double-checked the Netlify deployment, and my changes look good)
- [ ] Code example added (and I also added the example to all translated languages)
- [ ] Improved translation
- [ ] Added new translation (and I also added a notice to each document missing translation)
Checklist
- [ ] I have read the contributing document.
- [ ] I have used hugo to render the site/docs locally and I am sure it works.
PR Type
Tests, Enhancement
Description
- Added multiple tests for various browsing context events and operations, including creation, destruction, navigation, and user prompts.
- Enhanced the
BaseTestclass to include WebSocket URL option in ChromeOptions. - Updated NuGet configuration to include GitHub Packages as a source.
- Upgraded Selenium.WebDriver package to a nightly version for testing.
Changes walkthrough 📝
| Relevant files | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 1 files
| ||||||||||||||||||||||
| Tests | 11 files
| ||||||||||||||||||||||
| Configuration changes | 1 files
| ||||||||||||||||||||||
| Dependencies | 1 files
|
💡 PR-Agent usage: Comment
/helpon the PR to get a list of all available PR-Agent tools and their descriptions
Deploy request for selenium-dev pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | f121c9efae0af31d833953c6561fcb23d39bab87 |
PR Reviewer Guide 🔍
| ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪ |
| 🧪 PR contains tests |
| 🔒 No security concerns identified |
| ⚡ Key issues to review Commented Code Nightly Version |
PR Code Suggestions ✨
| Category | Suggestion | Score |
| Possible issue |
Uncomment the line to handle the user prompt in the testUncomment the line to handle the user prompt. This will allow the test to properly examples/dotnet/SeleniumDocs/BiDi/BrowsingContext/BrowsingContextTest.UserPromptEvent.cs [48]
Suggestion importance[1-10]: 9Why: Uncommenting the line to handle the user prompt is crucial for the test to function correctly, as it ensures the prompt is properly closed and the event can complete. This addresses a potential issue in the test logic. | 9 |
| Enhancement |
Add a timeout to the HandleUserPromptAsync method callConsider adding a timeout parameter to the HandleUserPromptAsync method call to examples/dotnet/SeleniumDocs/BiDi/BrowsingContext/BrowsingContextTest.UserPromptEvent.cs [48]
Suggestion importance[1-10]: 8Why: Adding a timeout to the HandleUserPromptAsync method call is a valuable enhancement that prevents indefinite waiting, improving the robustness of the test in case of unexpected issues. | 8 |
Add assertions to verify the content of the user promptConsider adding assertions to verify the content of the user prompt, such as its examples/dotnet/SeleniumDocs/BiDi/BrowsingContext/BrowsingContextTest.UserPromptEvent.cs [29-30]
Suggestion importance[1-10]: 7Why: Adding assertions to verify the content of the user prompt enhances the test by ensuring that the correct prompt is being handled, which improves test accuracy and reliability. | 7 | |
| Best practice |
Add error handling for the user prompt interactionConsider adding a try-catch block around the event handling to gracefully handle any examples/dotnet/SeleniumDocs/BiDi/BrowsingContext/BrowsingContextTest.UserPromptEvent.cs [46-50]
Suggestion importance[1-10]: 8Why: Implementing a try-catch block for error handling during user prompt interaction is a best practice that enhances the test's robustness by gracefully managing exceptions and providing informative error messages. | 8 |
Still waiting when we break nested types here https://github.com/SeleniumHQ/selenium/issues/15407
@nvborisenko, what needs to be done in this PR to have it ready?
Find a motivation, and then: