Skip to content

docs: fix Chrome documentation references#2706

Open
noritaka1166 wants to merge 2 commits into
SeleniumHQ:trunkfrom
noritaka1166:fix/chrome-documentation-references
Open

docs: fix Chrome documentation references#2706
noritaka1166 wants to merge 2 commits into
SeleniumHQ:trunkfrom
noritaka1166:fix/chrome-documentation-references

Conversation

@noritaka1166

Copy link
Copy Markdown
Contributor

Description

  • Updated Chrome documentation gh-codeblock references to point to the current Java, C#, and Ruby examples.
  • Applied the reference corrections consistently across the English, Japanese, Portuguese, and Simplified Chinese Chrome documentation pages.
  • Fixed the Chrome DevTools links in the Japanese and Portuguese documentation.

Motivation and Context

Several gh-codeblock line references had drifted from their source examples, causing documentation to display unrelated setup or cleanup code instead of the intended browser configuration and feature examples. This change restores accurate, runnable code snippets.

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

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b10e137

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Fix Chrome docs gh-codeblock references across translations

📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Correct gh-codeblock line ranges to show intended Chrome option examples.
• Apply the same reference fixes across EN/JA/PT-BR/ZH-CN Chrome docs.
• Fix broken Chrome DevTools links in Japanese and Portuguese pages.
Diagram

graph TD
  A["Chrome docs (4 locales)"] --> B["gh-codeblock shortcodes"] --> C["Language examples"] --> D["Hugo build"] --> E["Rendered snippets"]
  A --> F["CDP/DevTools doc"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use snippet markers instead of line numbers
  • ➕ Prevents drift when example files change
  • ➕ Makes intent clearer (snippet name conveys purpose)
  • ➕ Reduces maintenance across translations
  • ➖ Requires updating example sources to add markers/comments
  • ➖ May need shortcode support if not already available
2. Extract dedicated snippet files per doc section
  • ➕ Docs references become stable file paths without fragile ranges
  • ➕ Snippets can be kept minimal and purpose-built
  • ➖ Introduces duplication risk between snippets and full examples
  • ➖ More files to manage and keep in sync
3. Add CI validation for gh-codeblock ranges/targets
  • ➕ Catches broken/misaligned references before merge
  • ➕ Scales well as examples evolve
  • ➖ Requires building a validator and maintaining it
  • ➖ May add CI runtime and occasional false positives

Recommendation: The PR’s direct line-range corrections are the right short-term fix and restore accurate snippets immediately. For long-term stability, prefer marker-based snippet inclusion (and optionally a lightweight CI check) to avoid repeated drift across all translated pages whenever example files are edited.

Files changed (4) +128 / -128

Documentation (4) +128 / -128
chrome.en.mdRealign gh-codeblock line ranges for Chrome examples (EN) +30/-30

Realign gh-codeblock line ranges for Chrome examples (EN)

• Updates multiple gh-codeblock references to point at the correct Java, C#, and Ruby lines so rendered snippets match the described Chrome options/features. This fixes snippet drift that previously surfaced unrelated setup/teardown code.

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md

chrome.ja.mdSync Chrome snippet references and fix DevTools link (JA) +33/-33

Sync Chrome snippet references and fix DevTools link (JA)

• Mirrors the EN gh-codeblock reference corrections for Java/C#/Ruby snippets in the Japanese Chrome docs. Also replaces the DevTools mention with a working internal ref link to the CDP/DevTools documentation.

website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md

chrome.pt-br.mdSync Chrome snippet references and fix DevTools link (PT-BR) +33/-33

Sync Chrome snippet references and fix DevTools link (PT-BR)

• Applies the same gh-codeblock line-range corrections so PT-BR pages render the intended Chrome examples. Fixes the DevTools section link to reference the CDP/DevTools documentation via Hugo ref.

website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md

chrome.zh-cn.mdSync Chrome snippet references across examples (ZH-CN) +32/-32

Sync Chrome snippet references across examples (ZH-CN)

• Updates gh-codeblock references to the current Java/C#/Ruby snippet line ranges in the Simplified Chinese Chrome docs, ensuring the embedded examples match the surrounding guidance.

website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md

@qodo-code-review

qodo-code-review Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Extension snippet missing setup ✓ Resolved 🐞 Bug ≡ Correctness
Description
The “Add extensions” Java gh-codeblock now embeds ChromeTest.java#L72-L76, which references
driver without including the earlier driver/options setup (e.g., `driver = new
ChromeDriver(options);`). This renders an incomplete/misleading excerpt for the “Add an extension to
options” section across English, Japanese, Portuguese, and Simplified Chinese pages.
Code

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md[115]

+{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java#L72-L76" >}}
Evidence
The docs now reference only #L72-L76 for the Java extension example, but in the referenced source
file driver is created at line 70 and then used at line 73; therefore the embedded excerpt omits
required setup and will render an incomplete snippet.

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md[105-132]
website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md[104-131]
website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md[102-131]
website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md[104-131]
examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java[63-77]

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 Java code excerpt used in the “Add extensions” section is not self-contained: it shows only the WebExtension install lines but omits the prior options setup and driver creation, while still referencing `driver`.

### Issue Context
`ChromeTest.java#L72-L76` starts after `driver = new ChromeDriver(options);` and therefore the rendered snippet depends on context that readers cannot see.

### Fix Focus Areas
- website_and_docs/content/documentation/webdriver/browsers/chrome.en.md[111-116]
- website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md[110-115]
- website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md[110-115]
- website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md[110-115]

### Suggested fix
Update the Java `gh-codeblock` range to include the missing setup lines (for example, change `#L72-L76` to `#L66-L76`, which includes `ChromeOptions` setup and `driver = new ChromeDriver(options);` before the extension installation). Apply the same range update consistently across all four language pages.

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


Grey Divider

Previous review results

Review updated until commit b10e137

Results up to commit 58bc71b


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


Remediation recommended
1. Extension snippet missing setup ✓ Resolved 🐞 Bug ≡ Correctness
Description
The “Add extensions” Java gh-codeblock now embeds ChromeTest.java#L72-L76, which references
driver without including the earlier driver/options setup (e.g., `driver = new
ChromeDriver(options);`). This renders an incomplete/misleading excerpt for the “Add an extension to
options” section across English, Japanese, Portuguese, and Simplified Chinese pages.
Code

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md[115]

+{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java#L72-L76" >}}
Evidence
The docs now reference only #L72-L76 for the Java extension example, but in the referenced source
file driver is created at line 70 and then used at line 73; therefore the embedded excerpt omits
required setup and will render an incomplete snippet.

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md[105-132]
website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md[104-131]
website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md[102-131]
website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md[104-131]
examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java[63-77]

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 Java code excerpt used in the “Add extensions” section is not self-contained: it shows only the WebExtension install lines but omits the prior options setup and driver creation, while still referencing `driver`.

### Issue Context
`ChromeTest.java#L72-L76` starts after `driver = new ChromeDriver(options);` and therefore the rendered snippet depends on context that readers cannot see.

### Fix Focus Areas
- website_and_docs/content/documentation/webdriver/browsers/chrome.en.md[111-116]
- website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md[110-115]
- website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md[110-115]
- website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md[110-115]

### Suggested fix
Update the Java `gh-codeblock` range to include the missing setup lines (for example, change `#L72-L76` to `#L66-L76`, which includes `ChromeOptions` setup and `driver = new ChromeDriver(options);` before the extension installation). Apply the same range update consistently across all four language pages.

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


Qodo Logo

Comment thread website_and_docs/content/documentation/webdriver/browsers/chrome.en.md Outdated
@qodo-code-review

Copy link
Copy Markdown
Contributor

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

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.

1 participant