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-debugging.md

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

Locator Strategies Debugging And Mistakes

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.

Avoiding Common Mistakes

[no] Wrong: Brittle CSS Selectors

// Brittle - relies on styling classes
By.cssSelector("div.MuiBox-root > div.MuiContainer-root button.MuiButton-containedPrimary")
By.cssSelector(".styles__button___2K8Hx")  // CSS modules hash

[ok] Right: Stable Selectors

By.cssSelector("[data-testid='submit-button']")
By.cssSelector("button[type='submit']")
By.id("submit-button")

[no] Wrong: Absolute XPath

By.xpath("/html/body/div[1]/div/div[2]/form/div[3]/button")

[ok] Right: Relative XPath

By.xpath("//form[@id='login']//button[@type='submit']")

[no] Wrong: Index Without Context

By.xpath("(//button)[5]")  // Which button? Why 5?

[ok] Right: Meaningful Context

By.xpath("//div[@class='user-actions']//button[text()='Delete']")
By.cssSelector(".user-actions button[data-action='delete']")

Debugging Locators

Using Browser DevTools

  1. Open DevTools (F12)
  2. In Console, test selectors:
// CSS Selector
document.querySelector('[data-testid="submit"]');
document.querySelectorAll("table tbody tr");

// XPath
$x("//button[text()='Submit']");
$x("//input[@id='email']/ancestor::form");

Using Selenium

// Check if element exists
public boolean isElementPresent(By locator) {
    try {
        driver.findElement(locator);
        return true;
    } catch (NoSuchElementException e) {
        return false;
    }
}

// Count matching elements
public int countElements(By locator) {
    return driver.findElements(locator).size();
}

// Get all matching elements for debugging
public void debugLocator(By locator) {
    var elements = driver.findElements(locator);
    log.info("Found {} elements for locator: {}", elements.size(), locator);
    for (var element : elements) {
        log.info("  - Tag: {}, Text: {}", element.getTagName(), element.getText());
    }
}

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