Repository navigation
List built-in wait conditions on the Waits page - #2974
AutomatedTester wants to merge 6 commits into
Conversation
✅ Deploy Preview for selenium-dev ready!
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
62572fb to
a8d0fde
Compare
|
CI note: the only red check is This PR doesn't touch that test or its page. The same group of mouse tests also fails intermittently on
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
left a comment
There was a problem hiding this comment.
If possible please rephrase this.
|
/agentic_review |
Code Review by Qodo
1. Waits can finish while an element is visible
|
| | `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 | |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
|
@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
|
Both Qodo findings were real. ffdc3c3 fixes them on all four language pages:
While self-reviewing against 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 |
|
CI note for ffdc3c3: This isn't from this PR. The fixup commit only changes text in 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
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:
ExpectedConditions), Python (expected_conditions) and JavaScript (until). The lists come from the currenttrunksources:ExpectedConditions.java,expected_conditions.pyanduntil.js.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.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_conditionsexamples/javascript/test/waits/waits.spec.js:expected conditionsThe new imports in the Java and Python files move existing lines down by one. This PR updates every
gh-codeblockrange that points to those two files, inwaits.*.md(all languages),guides/waiting.en.mdandai_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 readnode_modules/selenium-webdriver/lib/until.jsto check. Others used conditions from memory.Types of changes
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
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_TOKENwas set.🤖 Generated with Claude Code
https://claude.ai/code/session_01LA4X4y2cMRjKqDaAwexzDp