本文へスキップ
Skillpedia
テスト48k · #5711

selenium-skill

できること

このツールは、ウェブサイトの自動テストコードを作成します。ユーザーの操作を模倣して、ウェブサイトが正しく動作しているかを確認するのに役立ちます。

使う場面

  • ✓複数のブラウザでウェブサイトが動作するかをテストしたいとき。
  • ✓ウェブサイトの品質を確かめるための自動テストを作成する必要があるとき。
  • ✓ウェブサイトの利用をシミュレーションして、エラーを見つけたいとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/selenium-skill/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/selenium-skill/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Javaで、ウェブサイトXのログインを確認する自動テストを作成してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

使用するプログラミング言語と、テストを実行する場所(自分のパソコンまたはクラウド)を選びます。このツールは、テストが安定して動き、保守しやすくなるようベストプラクティスに沿ったコードを生成します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Selenium Automation Skill

When to Use

Use this skill when you need generates production-grade Selenium WebDriver automation scripts and tests in Java, Python, JavaScript, C#, Ruby, or PHP. Supports local execution and TestMu AI cloud with 3000+ browser/OS combinations. Use when the user asks to write Selenium tests, automate with WebDriver, run...

You are a senior QA automation architect. You write production-grade Selenium WebDriver scripts and tests that run locally or on TestMu AI cloud.

Step 1 — Execution Target

User says "automate" / "test my site"
│
├─ Mentions "cloud", "TestMu", "LambdaTest", "Grid", "cross-browser", "real device"?
│  └─ TestMu AI cloud (RemoteWebDriver)
│
├─ Mentions specific combos (Safari on Windows, old browsers)?
│  └─ Suggest TestMu AI cloud
│
├─ Mentions "locally", "my machine", "ChromeDriver"?
│  └─ Local execution
│
└─ Ambiguous? → Default local, mention cloud for broader coverage

Step 2 — Language Detection

Signal Language Config
Default / no signal Java Maven + JUnit 5
"Python", "pytest", ".py" Python pip + pytest
"JavaScript", "Node", ".js" JavaScript npm + Mocha/Jest
"C#", ".NET", "NUnit" C# NuGet + NUnit
"Ruby", ".rb", "RSpec" Ruby gem + RSpec
"PHP", "Codeception" PHP Composer + PHPUnit

For non-Java languages → read reference/<language>-patterns.md

Step 3 — Scope

Request Type Action
"Write a test for X" Single test file, inline setup
"Set up Selenium project" Full project with POM, config, base classes
"Fix/debug test" Read reference/debugging-common-issues.md
"Run on cloud" Read reference/cloud-integration.md

Core Patterns — Java (Default)

Locator Priority

1. By.id("element-id")           ← Most stable
2. By.name("field-name")         ← Form elements
3. By.cssSelector(".class")      ← Fast, readable
4. By.xpath("//div[@data-testid]") ← Last resort

NEVER use: fragile XPaths like //div[3]/span[2]/a, absolute paths.

Wait Strategy — CRITICAL

// ✅ ALWAYS use explicit waits
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("submit")));

// ❌ NEVER use Thread.sleep() or implicit waits mixed with explicit
Thread.sleep(3000); // FORBIDDEN
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10)); // Don't mix

Anti-Patterns

Bad Good Why
Thread.sleep(5000) Explicit WebDriverWait Flaky, slow
Implicit + explicit waits Only explicit waits Unpredictable timeouts
driver.findElement() without wait Wait then find NoSuchElementException
Absolute XPath Relative CSS/ID Breaks on DOM changes
No driver.quit() Always quit() in finally/teardown Leaks browsers

Basic Test Structure

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.junit.jupiter.api.*;
import java.time.Duration;

public class LoginTest {
    private WebDriver driver;
    private WebDriverWait wait;

    @BeforeEach
    void setUp() {
        driver = new ChromeDriver();
        wait = new WebDriverWait(driver, Duration.ofSeconds(10));
        driver.manage().window().maximize();
    }

    @Test
    void testLogin() {
        driver.get("https://example.com/login");
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username")))
            .sendKeys("user@test.com");
        driver.findElement(By.id("password")).sendKeys("password123");
        driver.findElement(By.cssSelector("button[type='submit']")).click();
        wait.until(ExpectedConditions.urlContains("/dashboard"));
        Assertions.assertTrue(driver.getTitle().contains("Dashboard"));
    }

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

Page Object Model — Quick Example

// pages/LoginPage.java
public class LoginPage {
    private WebDriver driver;
    private WebDriverWait wait;

    private By usernameField = By.id("username");
    private By passwordField = By.id("password");
    private By submitButton  = By.cssSelector("button[type='submit']");


…
よくある質問

Selenium WebDriverとは何ですか?

ChromeやFirefoxなどのブラウザを、コードで操作できるようにするツールです。クリックや文字入力などの操作を模倣できます。

この文脈での「クラウド」とは何ですか?

さまざまなブラウザやOSを搭載した多数のコンピュータをオンラインで提供するサービスです。これを使うと、さまざまな組み合わせの環境でテストを実行し、ウェブサイトが正しく動くかを確認できます。

コードで「待機」を使うのはなぜですか?

ウェブページは読み込みにかかる時間がそれぞれ異なります。待機を入れることで、正しい要素が表示されるか操作可能になるまで待ってから操作できるため、エラーを防げます。

詳細

作者による元の説明

Generates production-grade Selenium WebDriver automation scripts and tests in Java, Python, JavaScript, C#, Ruby, or PHP. Supports local execution and TestMu AI cloud with 3000+ browser/OS combinations.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5711
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル