AGENT SKILL

se-cross-browser-runner

Sets up cross-browser Selenium execution across Chrome, Firefox, and Edge via TestNG parameters or a factory, plus a browser matrix. Use when an SDET says "run my tests on Chrome and Firefox", "add cross-browser support", "parameterize the browser in testng.xml", "set up a browser matrix", or wants multi-browser CI runs. Produces config and code the engineer must run per browser to confirm.

License 许可
MIT
最近更新
2026-07-15
Stars
★ 4
Forks
8

01 前言 Front Matter

name
se-cross-browser-runner
license
MIT
metadata
{ "pack": "selenium", "author": "TheTestingAcademy", "version": "1.0.0" }
description
Sets up cross-browser Selenium execution across Chrome, Firefox, and Edge via TestNG parameters or a factory, plus a browser matrix. Use when an SDET says "run my tests on Chrome and Firefox", "add cross-browser support", "parameterize the browser in testng.xml", "set up a browser matrix", or wants multi-browser CI runs. Produces config and code the engineer must run per browser to confirm.

03 SKILL.md 正文

Selenium Cross-Browser Runner

You wire tests to run across multiple browsers via TestNG parameters/factory and a browser matrix. The setup is a draft the engineer must actually run on each browser — you cannot confirm every browser is installed or behaves identically.

When to use

  • The same suite must execute on Chrome, Firefox, and/or Edge.
  • Someone wants the browser selectable from testng.xml or a system property.
  • A CI browser matrix (browser × maybe version/OS) needs defining.

Workflow

  1. Parameterize the browser: a @Parameters("browser") value from testng.xml, or a @Factory that instantiates the test class once per browser.
  2. Route to a driver factory that maps the parameter to ChromeDriver/ FirefoxDriver/EdgeDriver with per-browser options (reuse se-driver-manager).
  3. Define suite blocks in testng.xml — one <test> per browser, or a single test parameterized and run under parallel="tests" for concurrency.
  4. Keep tests browser-agnostic: no browser-specific locators or waits; differences go in options only.
  5. Add a matrix note for CI (e.g. GitHub Actions strategy matrix) so the same suite fans out across browsers.
  6. Emit testng.xml + factory glue and list browsers you could not verify installed.

Output shape

<!-- testng.xml — one <test> per browser, run in parallel -->
<suite name="cross-browser" parallel="tests" thread-count="3">
  <test name="chrome">  <parameter name="browser" value="chrome"/>  <classes><class name="com.qa.tests.LoginTest"/></classes></test>
  <test name="firefox"> <parameter name="browser" value="firefox"/> <classes><class name="com.qa.tests.LoginTest"/></classes></test>
  <test name="edge">    <parameter name="browser" value="edge"/>    <classes><class name="com.qa.tests.LoginTest"/></classes></test>
</suite>
public class BaseTest {
    protected WebDriver driver;

    @Parameters("browser")
    @BeforeMethod
    public void setUp(@Optional("chrome") String browser) {
        driver = DriverFactory.create(browser);   // maps param -> Chrome/Firefox/Edge (+ options)
    }

    @AfterMethod
    public void tearDown() { if (driver != null) driver.quit(); }
}

Guardrails

  • This is a draft the engineer must run on each browser — passing on Chrome does not prove Firefox/Edge pass.
  • Never assume a locator exists, and never write browser-specific locators; a matrix only works if tests are browser-agnostic.
  • Don't fabricate that a browser is installed; if you can't confirm Edge/Firefox availability, say the engineer must verify.
  • Keep browser differences confined to driver options — not to test logic or waits.
  • Size thread-count to real machine capacity; over-parallelizing browsers causes flakiness.
  • Always quit() each browser session to avoid leaking processes across the matrix.

04 同仓库更多 Skills

PramodDutta
PramodDutta/skillmasterclass

se-wait-fixer

Scans Selenium Java code for Thread.sleep and for implicit+explicit wait mixing, then replaces them with WebDriverWait/ExpectedConditions or FluentWait to fix synchronization. Use when an SDET says "remove Thread.sleep from my tests", "fix the flaky waits", "my implicit and explicit waits conflict", or pastes code full of hard sleeps. Produces refactors the engineer must run and confirm.

★ 4
PramodDutta
PramodDutta/skillmasterclass

se-test-generator

Generates a runnable Selenium 4 + TestNG test in Java from a plain-language scenario, using explicit waits and stable locators. Use when an SDET says "write a Selenium test for login", "generate a TestNG test for the checkout flow", "automate this scenario in Selenium", or pastes Gherkin/steps and wants Java WebDriver code. Produces a draft test the engineer must review and run.

★ 4
PramodDutta
PramodDutta/skillmasterclass

se-report-integrator

Integrates reporting (Allure or ExtentReports) into a Selenium + TestNG suite with listeners, screenshot-on-failure, and step logging. Use when an SDET says "add Allure to my tests", "set up ExtentReports", "capture a screenshot on failure", "add a TestNG listener for reporting", or wants readable run reports. Produces listener and config code the engineer must run to generate a report.

★ 4
PramodDutta
PramodDutta/skillmasterclass

se-page-object-builder

Builds a Page Object Model class in Java (PageFactory @FindBy or explicit locators) with action methods and a WebDriverWait for a given page. Use when an SDET says "create a page object for the login page", "build a POM class", "refactor these locators into a page object", or pastes a page's fields and wants a reusable POM. Produces a draft class the engineer must review and run.

★ 4
PramodDutta
PramodDutta/skillmasterclass

se-locator-strategist

Recommends and repairs Selenium locator strategy — replaces brittle absolute XPath with By.id, By.cssSelector, or Selenium 4 relative locators, and explains the trade-offs. Use when an SDET says "this XPath keeps breaking", "make this locator more stable", "why is my locator flaky", "convert this XPath to CSS", or pastes selectors to harden. Produces proposals the engineer must verify in the DOM.

★ 4
PramodDutta
PramodDutta/skillmasterclass

se-grid-configurator

Configures Selenium Grid 4 (hub-and-node or standalone, including Docker) and wires RemoteWebDriver for parallel and distributed runs. Use when an SDET says "set up Selenium Grid", "run my tests on a remote grid", "dockerize Selenium Grid 4", "point my tests at RemoteWebDriver", or wants parallel execution across nodes. Produces config and code the engineer must run and validate in their environment.

★ 4