Skip to content

Update CSharp code block reference in options.en.md#2612

Open
kimtg wants to merge 1 commit intoSeleniumHQ:trunkfrom
kimtg:patch-2
Open

Update CSharp code block reference in options.en.md#2612
kimtg wants to merge 1 commit intoSeleniumHQ:trunkfrom
kimtg:patch-2

Conversation

@kimtg
Copy link
Copy Markdown

@kimtg kimtg commented Mar 30, 2026

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Motivation and Context

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.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 30, 2026

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2253caf

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add CSharp code block reference to options documentation

📝 Documentation

Grey Divider

Walkthroughs

Description
• Replace placeholder badge with actual CSharp code reference
• Link to specific code example in dotnet SeleniumDocs repository
• Maintain consistency with other language code block references
Diagram
flowchart LR
  A["Badge placeholder"] -- "replaced with" --> B["gh-codeblock reference"]
  B -- "points to" --> C["OptionsTest.cs lines 59-60"]
Loading

Grey Divider

File Changes

1. website_and_docs/content/documentation/webdriver/drivers/options.en.md 📝 Documentation +1/-1

Replace CSharp badge placeholder with code reference

• Replaced generic badge-code placeholder with specific gh-codeblock reference
• Added path to CSharp example file: /examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L59-60
• Aligns CSharp documentation with Python and Ruby code block references

website_and_docs/content/documentation/webdriver/drivers/options.en.md


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review bot commented Mar 30, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Empty C# code block 🐞 Bug ✓ Correctness
Description
options.en.md now references OptionsTest.cs#L59-60, but OptionsTest.cs ends at line 57, so
gh-codeblock will slice an empty snippet and render a blank code block for the CSharp tab.
Code

website_and_docs/content/documentation/webdriver/drivers/options.en.md[415]

+{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L59-60">}}
Evidence
The page now includes a gh-codeblock pointing at OptionsTest.cs#L59-60, but the referenced file
only contains 57 lines. The shortcode computes an index based on the fragment and uses
after/first to slice lines; when the starting index is beyond the file length, the resulting
slice is empty, producing an empty highlighted block.

website_and_docs/content/documentation/webdriver/drivers/options.en.md[407-420]
examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs[1-57]
website_and_docs/layouts/shortcodes/gh-codeblock.html[44-52]

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 C# `gh-codeblock` reference points to a line range that does not exist in the referenced file, which renders an empty code snippet.

### Issue Context
`gh-codeblock` slices the remote file content based on the `#Lx-y` fragment; if `fromLine` is beyond EOF, the snippet becomes empty.

### Fix Focus Areas
- website_and_docs/content/documentation/webdriver/drivers/options.en.md[414-416]
- examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs[1-57]

### What to change
- Update the `path=` fragment to a valid line range that exists in the target file **and** actually demonstrates `unhandledPromptBehavior` for C#.
- If there is no valid C# example yet, revert this tab back to `{{< badge-code >}}` until a suitable example is added.

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



Remediation recommended

2. Code modal ID collision 🐞 Bug ⛯ Reliability
Description
gh-codeblock uses only the file path to generate modal IDs, so adding another snippet from the
already-reused OptionsTest.cs path increases duplicate HTML IDs and can cause “View Complete Code”
to open the wrong modal content.
Code

website_and_docs/content/documentation/webdriver/drivers/options.en.md[415]

+{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L59-60">}}
Evidence
options.en.md already embeds multiple gh-codeblock snippets from the same OptionsTest.cs path
(different fragments). The shortcode derives $uniqueId from md5 $path (path only, not fragment),
and uses that value in element IDs; multiple instances on the same page therefore produce duplicate
IDs and event handlers targeting the first matching element.

website_and_docs/content/documentation/webdriver/drivers/options.en.md[114-125]
website_and_docs/content/documentation/webdriver/drivers/options.en.md[155-166]
website_and_docs/content/documentation/webdriver/drivers/options.en.md[195-205]
website_and_docs/content/documentation/webdriver/drivers/options.en.md[407-419]
website_and_docs/layouts/shortcodes/gh-codeblock.html[62-66]
website_and_docs/layouts/shortcodes/gh-codeblock.html[76-90]

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

### Issue description
Multiple `gh-codeblock` invocations referencing the same file path on the same page create duplicate modal element IDs, which can break the “View Complete Code” behavior.

### Issue Context
`gh-codeblock` sets `$uniqueId := md5 $path`, so the ID does not vary by fragment/line range.

### Fix Focus Areas
- website_and_docs/layouts/shortcodes/gh-codeblock.html[62-66]
- website_and_docs/layouts/shortcodes/gh-codeblock.html[76-93]

### What to change
- Derive the modal ID from something truly unique per embed, e.g. hash `$fullPath` (includes fragment) instead of `$path`, or concatenate `$path` + fragment before hashing.
- Ensure all `id=` attributes and JS calls (`showCodeModal`, `closeCodeModal`, `copyCode`) use the updated unique ID consistently.

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


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

{{% /tab %}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L59-60">}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Empty c# code block 🐞 Bug ✓ Correctness

options.en.md now references OptionsTest.cs#L59-60, but OptionsTest.cs ends at line 57, so
gh-codeblock will slice an empty snippet and render a blank code block for the CSharp tab.
Agent Prompt
### Issue description
The C# `gh-codeblock` reference points to a line range that does not exist in the referenced file, which renders an empty code snippet.

### Issue Context
`gh-codeblock` slices the remote file content based on the `#Lx-y` fragment; if `fromLine` is beyond EOF, the snippet becomes empty.

### Fix Focus Areas
- website_and_docs/content/documentation/webdriver/drivers/options.en.md[414-416]
- examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs[1-57]

### What to change
- Update the `path=` fragment to a valid line range that exists in the target file **and** actually demonstrates `unhandledPromptBehavior` for C#.
- If there is no valid C# example yet, revert this tab back to `{{< badge-code >}}` until a suitable example is added.

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

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.

2 participants