Skip to content

Conversation

@DNotNice
Copy link
Contributor

@DNotNice DNotNice commented Oct 8, 2025

User description

Added Kotlin Waits Code Example

Description

Added Kotlin examples for Selenium waits in the code section. Previously, Kotlin examples were missing, making it harder for Kotlin developers to reference wait implementations directly from the documentation.

Motivation and Context

Providing Kotlin wait examples ensures that Kotlin developers can quickly find and reference proper Selenium wait usage, improving accessibility and completeness of the documentation.

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

PR Type

Enhancement


PR Type

Documentation, Enhancement


Description

  • Added comprehensive Kotlin code examples for Selenium waits

  • Created test file with implicit, explicit, and fluent wait implementations

  • Updated documentation to reference Kotlin examples across multiple languages

  • Replaced placeholder badges with actual code block references


Diagram Walkthrough

flowchart LR
  A["New Kotlin Test File"] --> B["Implicit Wait Example"]
  A --> C["Explicit Wait Example"] 
  A --> D["Fluent Wait Example"]
  E["Documentation Files"] --> F["Updated Code References"]
  B --> F
  C --> F
  D --> F
Loading

File Walkthrough

Relevant files
Tests
WaitsTest.kt
New Kotlin waits test implementation                                         

examples/kotlin/src/test/kotlin/dev/selenium/waits/WaitsTest.kt

  • Created new Kotlin test class extending BaseTest
  • Implemented three wait test methods: implicit, explicit, and fluent
  • Added proper imports for Selenium WebDriver and wait classes
  • Included assertions to verify wait functionality
+65/-0   
Documentation
waits.en.md
Updated English documentation with Kotlin examples             

website_and_docs/content/documentation/webdriver/waits.en.md

  • Replaced {{< badge-code >}} placeholders with actual Kotlin code
    references
  • Added links to specific lines in the new Kotlin test file
  • Updated three sections: implicit waits, explicit waits, and fluent
    waits
+3/-3     
waits.ja.md
Updated Japanese documentation with Kotlin examples           

website_and_docs/content/documentation/webdriver/waits.ja.md

  • Replaced {{< badge-code >}} placeholders with Kotlin code block
    references
  • Added same code references as English version for consistency
  • Updated Japanese documentation to include Kotlin examples
+3/-3     
waits.pt-br.md
Updated Portuguese documentation with Kotlin examples       

website_and_docs/content/documentation/webdriver/waits.pt-br.md

  • Replaced placeholder badges with actual Kotlin code references
  • Added links to specific test methods and line ranges
  • Updated Portuguese-Brazilian documentation with Kotlin examples
+3/-3     
waits.zh-cn.md
Updated Chinese documentation with Kotlin examples             

website_and_docs/content/documentation/webdriver/waits.zh-cn.md

  • Replaced {{< badge-code >}} with proper code block references
  • Added same Kotlin example links as other language versions
  • Updated Chinese documentation to include Kotlin code examples
+3/-3     

@netlify
Copy link

netlify bot commented Oct 8, 2025

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit bb28b4e

@CLAassistant
Copy link

CLAassistant commented Oct 8, 2025

CLA assistant check
All committers have signed the CLA.

@qodo-merge-pro
Copy link
Contributor

qodo-merge-pro bot commented Oct 8, 2025

PR Compliance Guide 🔍

(Compliance updated until commit bb28b4e)

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No audit logs: The new Kotlin examples perform actions (navigation, interactions) without emitting any
audit logs, though this may be acceptable for documentation/test code rather than
production logic.

Referred Code
fun implicit() {
    driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(2))
    driver.get("https://www.selenium.dev/selenium/web/dynamic.html")
    driver.findElement(By.id("adder")).click()

    val added = driver.findElement(By.id("box0"))

    Assertions.assertEquals("redbox",added.getDomAttribute("class"))

}

@Test
fun explicit() {

    driver.get("https://www.selenium.dev/selenium/web/dynamic.html")
    val revealed = driver.findElement(By.id("revealed"))
    driver.findElement(By.id("reveal")).click()

    val wait =  WebDriverWait(driver, Duration.ofSeconds(2))
    wait.until { revealed.isDisplayed }



 ... (clipped 25 lines)
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
No error handling: The example tests do not handle potential failures (timeouts, missing elements) with
contextual messages, which may be acceptable for concise documentation samples.

Referred Code
    driver.get("https://www.selenium.dev/selenium/web/dynamic.html")
    val revealed = driver.findElement(By.id("revealed"))
    driver.findElement(By.id("reveal")).click()

    val wait =  WebDriverWait(driver, Duration.ofSeconds(2))
    wait.until { revealed.isDisplayed }

    revealed.sendKeys("Displayed")
    Assertions.assertEquals("Displayed", revealed.getDomProperty("value"))
}

@Test
fun explicitWithOptions() {

    driver.get("https://www.selenium.dev/selenium/web/dynamic.html")

    val revealed = driver.findElement(By.id("revealed"))
    driver.findElement(By.id("reveal")).click()

    val wait: Wait<WebDriver?> =


 ... (clipped 12 lines)
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Previous compliance checks

Compliance check up to commit 9888241
Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

@qodo-merge-pro
Copy link
Contributor

qodo-merge-pro bot commented Oct 8, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Avoid performing actions inside waits

Separate the wait condition from the action by first waiting for the element to
be displayed with wait.until { revealed.isDisplayed } and then performing the
sendKeys action outside the wait block.

examples/kotlin/src/test/kotlin/dev/selenium/waits/WaitsTest.kt [57-60]

-wait.until {
-    revealed.sendKeys("Displayed")
-    true
-}
+wait.until { revealed.isDisplayed }
+revealed.sendKeys("Displayed")
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies an anti-pattern where an action is performed inside a wait condition, which is not a recommended practice and can lead to flaky tests.

Medium
  • Update

@rpallavisharma
Copy link
Member

PR looks fine to me. can be further reviewed for acceptance by TLC members.

@diemol
Copy link
Member

diemol commented Oct 30, 2025

@DNotNice can you please rebase this PR so we can merge?

@DNotNice DNotNice force-pushed the add-kotlin-waits-tests branch from 9888241 to c21963e Compare October 30, 2025 14:50
@DNotNice DNotNice force-pushed the add-kotlin-waits-tests branch from c21963e to bb28b4e Compare October 30, 2025 14:56
@DNotNice
Copy link
Contributor Author

@diemol I’ve rebased my branch on top of the latest trunk and force-pushed the updated commits.
The PR should now be up to date and ready for review/merge.

@diemol diemol merged commit e49b07e into SeleniumHQ:trunk Oct 31, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants