Skip to content

Add C# and Kotlin alert examples as tested code - #2919

Merged
diemol merged 7 commits into
SeleniumHQ:trunkfrom
githarshil:docs/alerts-csharp-kotlin-examples
Oct 20, 2026
Merged

diemol merged 7 commits into
SeleniumHQ:trunkfrom
githarshil:docs/alerts-csharp-kotlin-examples

Conversation

@githarshil

Copy link
Copy Markdown
Contributor

Description

Part of #2890.

Adds tested C# and Kotlin examples for the JavaScript alerts, prompts and confirmations page (webdriver/interactions/alerts):

  • examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs: alert, confirm and prompt tests
  • examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt: alert, confirm and prompt tests
  • Replaced the inline C# and Kotlin code in alerts.en.md, alerts.ja.md, alerts.pt-br.md and alerts.zh-cn.md with gh-codeblock references

The Java, Python, Ruby and JavaScript tabs already rendered from test files, so this makes all six bindings on this page test-backed.

Motivation and Context

The C# and Kotlin tabs on this page contained inline code that is not run in CI. Moving it into tests means the examples are verified, as described in the code examples contributing guide.

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.

Testing

The new C# and Kotlin tests and the Hugo build were not run locally (no .NET SDK, Maven or Hugo installed). I'm relying on CI for the tests and the Netlify preview for rendering, and I checked the displayed line ranges by hand against the files.

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for selenium-dev ready!

Name Link
🔨 Latest commit 7920790
🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/6ad770806fbb01d7780bd832
😎 Deploy Preview https://deploy-preview-2919--selenium-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@CLAassistant

CLAassistant commented Oct 19, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@githarshil

Copy link
Copy Markdown
Contributor Author

Hi! This is my first PR here. The C# and Kotlin tests and the Hugo build weren't run locally, so I'm relying on CI and the Netlify preview. Could a maintainer approve the workflow run and the Netlify deploy when you get a chance? Happy to fix anything that fails. @diemol

@diemol

diemol commented Oct 20, 2026

Copy link
Copy Markdown
Member

/agentic_review

@qodo-code-review

qodo-code-review Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Readers cannot trigger the shown dialogs ✓ Resolved
Description
The new C# and Kotlin alert snippets locate elements by id, while the documentation's adjacent
example links have no such IDs. The tests navigate to a separate alerts page where those IDs exist,
so copying the displayed alert, confirm, or prompt snippet for the documentation page fails to find
its trigger even though the tests pass.
Code

examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[R43-44]

+            // Click the link to activate the alert
+            driver.FindElement(By.Id("alert")).Click();
Evidence
The documentation renders See an example alert as an <a> with an onclick handler and no id;
its confirm and prompt links follow the same pattern. The new tests instead navigate to
/selenium/web/alerts.html and use By.Id("alert"), By.Id("confirm"), and By.Id("prompt");
those lines are what the new codeblock references display.

website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[29-39]
website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[64-80]
website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[95-113]
examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[39-47]
examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[59-64]
examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[83-88]
examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[20-28]
examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[39-44]
examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[62-67]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new C# and Kotlin snippets use IDs from a separate test page, not the links shown alongside them in the documentation.
## Fix Focus Areas
- examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[38-100]
- examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[20-79]
- website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[29-122]
## Recommended Fix
Run the C# and Kotlin examples against the documentation page and locate its alert, confirm, and prompt links as displayed. Update the assertions to match those dialogs, and keep the referenced snippet ranges aligned with the tested code.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
Review mode: Auto: 🚀 Fast: Localized example-test updates and repetitive documentation references pose contained risk.

Grey Divider

Tip of the day
💡 Did you know, you can open the rule or relationship behind a finding in one click

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 7920790

Results up to commit fe2c5a0 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Readers cannot trigger the shown dialogs ✓ Resolved
Description
The new C# and Kotlin alert snippets locate elements by id, while the documentation's adjacent
example links have no such IDs. The tests navigate to a separate alerts page where those IDs exist,
so copying the displayed alert, confirm, or prompt snippet for the documentation page fails to find
its trigger even though the tests pass.
Code

examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[R43-44]

+            // Click the link to activate the alert
+            driver.FindElement(By.Id("alert")).Click();
Evidence
The documentation renders See an example alert as an <a> with an onclick handler and no id;
its confirm and prompt links follow the same pattern. The new tests instead navigate to
/selenium/web/alerts.html and use By.Id("alert"), By.Id("confirm"), and By.Id("prompt");
those lines are what the new codeblock references display.

website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[29-39]
website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[64-80]
website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[95-113]
examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[39-47]
examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[59-64]
examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[83-88]
examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[20-28]
examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[39-44]
examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[62-67]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new C# and Kotlin snippets use IDs from a separate test page, not the links shown alongside them in the documentation.
## Fix Focus Areas
- examples/dotnet/SeleniumDocs/Interactions/AlertsTest.cs[38-100]
- examples/kotlin/src/test/kotlin/dev/selenium/interactions/AlertsTest.kt[20-79]
- website_and_docs/content/documentation/webdriver/interactions/alerts.en.md[29-122]
## Recommended Fix
Run the C# and Kotlin examples against the documentation page and locate its alert, confirm, and prompt links as displayed. Update the assertions to match those dialogs, and keep the referenced snippet ranges aligned with the tested code.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit fe2c5a0

@diemol diemol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@githarshil it seems there are compilation errors

@diemol

diemol commented Oct 20, 2026

Copy link
Copy Markdown
Member

/agentic_review

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 7b67bae

@githarshil
githarshil requested a review from diemol October 20, 2026 13:42
@diemol

diemol commented Oct 20, 2026

Copy link
Copy Markdown
Member

/agentic_review

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 993ecfc

@diemol
diemol requested a review from nvborisenko October 20, 2026 13:45
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 7920790

@diemol
diemol merged commit 563a40e into SeleniumHQ:trunk Oct 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants