All skills
fugazi avatar

/webapp-selenium-testing

@ef704d5

Author and maintain versioned Selenium WebDriver tests with Java and JUnit 5. Use for creating, debugging, or running Selenium specs, implementing Page Objects, handling explicit waits, capturing screenshots, or setting up Maven test projects. Supports Chrome, Firefox, and Edge. Keywords: Selenium WebDriver, Java, JUnit 5, Page Object Model, explicit waits, Maven, screenshots.

Use this Skill: https://skilld.dev/gh/fugazi/test-automation-skills-agents/webapp-selenium-testing

This session only. Nothing lands on disk.

referenceslocator-strategies-hierarchy.md

≈571 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Locator Strategies Priority Hierarchy

Part of the webapp-selenium-testing skill. See SKILL.md for full context.

Related: this file was split from the original locator-strategies.md. See the other related files in this folder.

Comprehensive guide for choosing and implementing the right locator strategy in Selenium tests.

Locator Priority Hierarchy

Always prefer locators higher in this list:

Priority Locator Type Example Why
1 ID By.id("login-button") Fastest, most stable
2 Name By.name("username") Stable, semantic
3 Test ID By.cssSelector("[data-testid='submit']") Explicit, stable
4 CSS Selector By.cssSelector("form#login input[type='email']") Flexible, fast
5 Link Text By.linkText("Sign up") For anchor elements
6 Class Name By.className("btn-primary") Can change with styling
7 XPath By.xpath("//button[@aria-label='Close']") Use only when necessary

ID-Based Locators (Best)

The fastest and most reliable locator strategy:

// [ok] BEST: Direct ID
By.id("login-button")
By.id("username")
By.id("password")
By.id("submit-form")

// Locator declaration pattern
private final By usernameInput = By.id("username");
private final By passwordInput = By.id("password");
private final By loginButton = By.id("login-button");

Test ID Locators (Recommended)

For elements without natural IDs, use test IDs:

// [ok] GOOD: Test IDs (stable, explicit)
By.cssSelector("[data-testid='user-avatar']")
By.cssSelector("[data-testid='cart-icon']")
By.cssSelector("[data-testid='product-card']")

// Alternative attributes
By.cssSelector("[data-qa='submit-button']")
By.cssSelector("[data-test='login-form']")

// With additional filtering
By.cssSelector("[data-testid='product-card'][data-product-id='123']")

Source: SKILL.md on GitHub

1 warning14d4 checks · Risk SAFE
  • Gen Agent Trust Hub14d

    The skill provides templates and scripts for Selenium WebDriver testing in Java. It is categorized as low risk due to potential indirect prompt injection vulnerabilities inherent in browser automation and the use of JavaScript execution in the browser context.

  • Socket14d

    No alerts

  • Snyk14d

    Risk: LOW · No issues

  • Runlayer6mo

    1/6 files flagged

Signed by skilld at ef704d5. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated 2 months ago

README badge

README badge for fugazi/test-automation-skills-agents/webapp-selenium-testing