Skip to content

List built-in wait conditions on the Waits page - #2974

Open
AutomatedTester wants to merge 6 commits into
trunkfrom
claude/project-thread-1s85b8
Open

AutomatedTester wants to merge 6 commits into
trunkfrom
claude/project-thread-1s85b8

Conversation

@AutomatedTester

@AutomatedTester AutomatedTester commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Requested by David · project thread

Thanks for contributing to the Selenium site and documentation!

I have signed the CLA.

Fixes #2971

Description

Adds a Built-in conditions section to the Waits page, under Explicit waits and before Customization:

  • The full list: a table of every built-in condition with a one-line description, for Java (ExpectedConditions), Python (expected_conditions) and JavaScript (until). The lists come from the current trunk sources: ExpectedConditions.java, expected_conditions.py and until.js.
  • One example per binding: it waits for a title, an element, its visibility and its text, using built-in conditions only. Java, Python and JavaScript render it with gh-codeblock. The .NET and Ruby tabs explain that those bindings use a lambda or a block instead. The Kotlin tab points to the Java class.
  • A link from the Expected Conditions page to the new list.

The examples follow the code example guidelines. Each one is its own test, runs against https://www.selenium.dev/selenium/web/web-form.html, and asserts the outcome:

  • examples/java/.../waits/WaitsTest.java: expectedConditions()
  • examples/python/tests/waits/test_waits.py: test_expected_conditions
  • examples/javascript/test/waits/waits.spec.js: expected conditions

The new imports in the Java and Python files move existing lines down by one. This PR updates every gh-codeblock range that points to those two files, in waits.*.md (all languages), guides/waiting.en.md and ai_agents/outdated_patterns.en.md.

Motivation and Context

In AXIS task runs, every agent that read /documentation/webdriver/waits/ reported that the condition it needed was not documented. Some then read node_modules/selenium-webdriver/lib/until.js to check. Others used conditions from memory.

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)

Translations: the new section, including the example, is in the ja, pt-br and zh-cn files. Its prose is in English and needs translating, following the style guide's "needs translation" process.

Netlify: nobody has reviewed the deploy preview yet.

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 Java (6/6), Python (6/6) and JavaScript (5/5) waits tests pass locally. They ran in headless Chrome 153 against a local copy of the Selenium test pages. The site builds with Hugo 0.169.0. The local build did not fetch the code blocks because no SELENIUM_CI_TOKEN was set.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LA4X4y2cMRjKqDaAwexzDp

@AutomatedTester AutomatedTester self-assigned this Nov 4, 2026
@CLAassistant

CLAassistant commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@netlify

netlify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for selenium-dev ready!

Name Link
🔨 Latest commit a0ef315
🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/6aec7eda866160908403e185
😎 Deploy Preview https://deploy-preview-2974--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.

Agents reading the Waits page concluded that the condition they needed
did not exist, because the page only showed one lambda per language.

Add a Built-in conditions section with the full list of ready-made
conditions for Java (ExpectedConditions), Python (expected_conditions)
and JavaScript (until), taken from the Selenium trunk sources, and say
that .NET and Ruby use lambdas and blocks instead.

Add one tested example per binding that waits for a title, an element,
its visibility and its text with built-in conditions only. The new
imports move existing lines by one, so update the gh-codeblock ranges
that point to the Java and Python waits tests in all languages.

Link the Expected Conditions page to the new list.

Fixes #2971

Claude-Session: https://claude.ai/code/session_01LA4X4y2cMRjKqDaAwexzDp
@AutomatedTester
AutomatedTester force-pushed the claude/project-thread-1s85b8 branch from 62572fb to a8d0fde Compare November 4, 2026 11:43
@AutomatedTester AutomatedTester changed the title List built-in wait conditions per language on the Waits page List built-in wait conditions on the Waits page Nov 4, 2026

Copy link
Copy Markdown
Member Author

CI note: the only red check is tests (ubuntu, stable) in Run Python examples. The test that failed is tests/actions_api/test_mouse.py::test_move_by_offset_from_viewport_origin_ab, with ValueError: invalid literal for int() with base 10: ''.

This PR doesn't touch that test or its page. The same group of mouse tests also fails intermittently on trunk:

  • run 41734661693 failed on test_move_by_offset_from_current_pointer_ab
  • run 41541022261 failed on test_hover

The failure looks like the tests read the coordinates text before the page has filled it in. This PR doesn't include a fix for it. All other example jobs pass, including the new waits examples. I've re-run the failed job once.


Generated by Claude Code

@rpallavisharma rpallavisharma 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.

If possible please rephrase this.

@diemol

diemol commented Nov 5, 2026

Copy link
Copy Markdown
Member

/agentic_review

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Waits can finish while an element is visible 🐞 Bug ≡ Correctness
Description
The invisibilityOfElementWithText row describes a visibility wait, but the condition succeeds when
no visible element has the specified text. If the element remains visible but its text changes,
readers following this description can continue before the element is hidden.
Code

website_and_docs/content/documentation/webdriver/waits.en.md[191]

+| `invisibilityOfElementWithText(By, text)` | An element with the given text is hidden or not in the DOM |
Evidence
The added row promises that an element with the given text is hidden or absent. Selenium's
implementation filters for elements whose text equals the supplied text and that are visible, then
succeeds if none remain; changing the text of a visible element therefore satisfies it.

website_and_docs/content/documentation/webdriver/waits.en.md[188-191]
🌐 The implementation searches for a visible element whose text equals the argument and returns true when none is found.

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 table presents `invisibilityOfElementWithText` as a check that an element becomes hidden, although it also succeeds when a visible element no longer has the specified text.

## Fix Focus Areas
- website_and_docs/content/documentation/webdriver/waits.en.md[191-191]
- website_and_docs/content/documentation/webdriver/waits.ja.md[186-186]
- website_and_docs/content/documentation/webdriver/waits.pt-br.md[186-186]
- website_and_docs/content/documentation/webdriver/waits.zh-cn.md[203-203]

## Recommended Fix
Describe the condition as succeeding when no visible element at the locator has the specified text, including when the element is absent, hidden, or its text changes. Update the corresponding rows in all four pages.

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

Dismiss ↗ | View ↗


2. Chinese readers cannot jump to the example 🐞 Bug ≡ Correctness
Description
The new .NET and Ruby links in waits.zh-cn.md target #explicit-waits, but the page's
corresponding heading is ## 显式等待 and defines no English anchor. On the Chinese Waits page, both
links therefore miss the explicit-wait example they reference.
Code

website_and_docs/content/documentation/webdriver/waits.zh-cn.md[162]

+[explicit wait](#explicit-waits) example.
Evidence
The Chinese page has a translated explicit-waits heading, while both newly added links use an
English heading fragment. Without an explicit ID, the fragment does not identify that section.

website_and_docs/content/documentation/webdriver/waits.zh-cn.md[100-100]
website_and_docs/content/documentation/webdriver/waits.zh-cn.md[160-166]

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 two new intra-page links in the Chinese Waits section use an English fragment that does not match the translated explicit-waits heading.

## Fix Focus Areas
- website_and_docs/content/documentation/webdriver/waits.zh-cn.md[100-100]
- website_and_docs/content/documentation/webdriver/waits.zh-cn.md[162-166]

## Recommended Fix
Change both new links to the fragment generated for the Chinese heading, or assign that heading an explicit `explicit-waits` ID so both links resolve.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
✅ Web pages:
  +12 more
Review mode: Auto: ⚖️ Balanced: Docs plus new tests; many line-range edits need careful verification.

Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display > Comment parts

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

| `invisibilityOfElementLocated(By)` | An element is hidden or not in the DOM |
| `invisibilityOf(WebElement)` | A known element is hidden or no longer in the DOM |
| `invisibilityOfAllElements(WebElement...)` | All given elements are hidden |
| `invisibilityOfElementWithText(By, text)` | An element with the given text is hidden or not in the DOM |

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.

Remediation recommended

1. Waits can finish while an element is visible 🐞 Bug ≡ Correctness

The invisibilityOfElementWithText row describes a visibility wait, but the condition succeeds when
no visible element has the specified text. If the element remains visible but its text changes,
readers following this description can continue before the element is hidden.
Agent Prompt
## Issue description
The Java table presents `invisibilityOfElementWithText` as a check that an element becomes hidden, although it also succeeds when a visible element no longer has the specified text.

## Fix Focus Areas
- website_and_docs/content/documentation/webdriver/waits.en.md[191-191]
- website_and_docs/content/documentation/webdriver/waits.ja.md[186-186]
- website_and_docs/content/documentation/webdriver/waits.pt-br.md[186-186]
- website_and_docs/content/documentation/webdriver/waits.zh-cn.md[203-203]

## Recommended Fix
Describe the condition as succeeding when no visible element at the locator has the specified text, including when the element is absent, hidden, or its text changes. Update the corresponding rows in all four pages.

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

Dismiss ↗ | View ↗

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in ffdc3c3 on all four pages. The row now says "No displayed element matching the locator has the given text", which matches the implementation (it filters on matching text and visible, and passes when none remain).


Generated by Claude Code

{{< /tab >}}
{{% tab header="CSharp" %}}
.NET does not ship built-in conditions. Pass a lambda to `WebDriverWait.Until()`, as in the
[explicit wait](#explicit-waits) example.

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.

Remediation recommended

2. Chinese readers cannot jump to the example 🐞 Bug ≡ Correctness

The new .NET and Ruby links in waits.zh-cn.md target #explicit-waits, but the page's
corresponding heading is ## 显式等待 and defines no English anchor. On the Chinese Waits page, both
links therefore miss the explicit-wait example they reference.
Agent Prompt
## Issue description
The two new intra-page links in the Chinese Waits section use an English fragment that does not match the translated explicit-waits heading.

## Fix Focus Areas
- website_and_docs/content/documentation/webdriver/waits.zh-cn.md[100-100]
- website_and_docs/content/documentation/webdriver/waits.zh-cn.md[162-166]

## Recommended Fix
Change both new links to the fragment generated for the Chinese heading, or assign that heading an explicit `explicit-waits` ID so both links resolve.

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

Dismiss ↗ | View ↗

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in ffdc3c3. Both links now use #显式等待, and a local Hugo build confirms they resolve to the zh-cn explicit-waits heading.


Generated by Claude Code

@diemol

diemol commented Nov 5, 2026

Copy link
Copy Markdown
Member

@AutomatedTester please trigger Qodo as well. Check the coments and solve them please.

invisibilityOfElementWithText also succeeds when a displayed element's
text changes, so describe it as "no displayed element has the text".

Describe the frame conditions as taking one frame argument in several
forms, instead of listing the forms like separate parameters.

The zh-cn page heading for explicit waits is translated, so link the
.NET and Ruby tabs to its real anchor.

Claude-Session: https://claude.ai/code/session_01LA4X4y2cMRjKqDaAwexzDp

Copy link
Copy Markdown
Member Author

Both Qodo findings were real. ffdc3c3 fixes them on all four language pages:

  1. invisibilityOfElementWithText now reads "No displayed element matching the locator has the given text". This matches the implementation, which also succeeds when the text changes.
  2. On the zh-cn page, the .NET and Ruby tabs now link to #显式等待, the page's real explicit-waits anchor.

While self-reviewing against .github/pr_review.md, I also reworded the Java and Python frame rows. They read as if the condition took several parameters, but it takes one frame argument in several forms.

I checked the rendered output with a local Hugo build: the links resolve on all four pages, and the markdown tabs render.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

CI note for ffdc3c3: tests (windows, nightly) in Run Python examples failed on tests/elements/test_file_upload.py::test_uploads, with NoSuchElementException for #uploaded-files.

This isn't from this PR. The fixup commit only changes text in waits.*.md, and the same test failed on trunk in run 41541022261. I'll re-run the job once the rest of the workflow finishes.


Generated by Claude Code

Use the wording suggested in review for the opening paragraph of the
Built-in conditions section on all language pages.

Claude-Session: https://claude.ai/code/session_01LA4X4y2cMRjKqDaAwexzDp

This branch has not been deployed

No deployments
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.

[🚀 Feature]: Waits page should list the built-in wait conditions per language

4 participants