Webdriver

From G1Joshi/Agent-Skills · View interactive version

Webdriver is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert W3C WebDriver automation covering standard browser protocols, remote sessions, and grid management. Use when managing browser automation infrastructure, Selenium Grid, or remote drivers.

How to use this skill

Skill file

WebDriver

WebDriver is the W3C standard protocol for controlling web browsers. It is the underlying technology behind Selenium, Appium, WebdriverIO, and more. Even if you use a high-level tool, understanding WebDriver helps debug low-level issues.

When to Use

Quick Start

import { remote } from "webdriverio";

const browser = await remote({
  capabilities: {
    browserName: "chrome",
    "goog:chromeOptions": { args: ["headless", "disable-gpu"] },
  },
});

await browser.url("https://webdriver.io");
const title = await browser.getTitle();
console.log(title); // outputs: "WebdriverIO ยท Next-gen browser and mobile automation test framework for Node.js"

await browser.deleteSession();

Core Concepts

W3C Standardized Endpoint Endpoints

All actions map to standardized REST endpoints defined in the W3C Recommendation:

POST /session                  # Create new browser session
POST /session/{id}/url         # Navigate to URL
POST /session/{id}/element     # Locate element
POST /session/{id}/element/{el}/click # Click element
DELETE /session/{id}           # Terminate browser session

Raw HTTP Session Orchestration

Interacting with ChromeDriver directly using curl or raw HTTP:

# 1. Start Chrome Session
curl -X POST http://localhost:9515/session \
  -H "Content-Type: application/json" \
  -d '{"capabilities": {"alwaysMatch": {"browserName": "chrome"}}}'
# Returns {"value": {"sessionId": "8f3d1e1c..."}}

# 2. Navigate to URL
curl -X POST http://localhost:9515/session/8f3d1e1c/url \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

WebdriverIO Standalone Client

Consuming WebDriver directly in TypeScript without full test runner frameworks:

import { remote } from "webdriverio";

const browser = await remote({
  capabilities: { browserName: "chrome" },
});

await browser.url("https://example.com");
const title = await browser.getTitle();
console.log("Page Title:", title);
await browser.deleteSession();

Common Patterns

Remote WebDriver Session with Desired Capabilities

Problem: Running tests against a centralized Selenium Grid or cloud browser provider.

Solution:

Configure RemoteWebDriver using standard W3C options:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--headless=new")
chrome_options.add_argument("--disable-gpu")

driver = webdriver.Remote(
    command_executor="http://grid-server:4444/wd/hub",
    options=chrome_options
)
driver.get("https://example.com")
print(driver.title)
driver.quit()

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :---------------------------------------------------------------------- | :-------------------------------------------------------------- | :---------------------------------------------------------------------- |

| WebDriverException: Message: Service chromedriver unexpectedly exited | Missing system dependencies (glibc, Xvfb) on headless runner. | Install missing libraries or verify driver binary matches architecture. |

| MaxSessionException: All nodes are currently busy | Selenium Grid capacity exceeded by concurrent test jobs. | Increase grid node replicas or configure queue timeouts. |

| InvalidSessionIdException | Browser process crashed or session timed out due to inactivity. | Verify memory usage on host and reduce session idle times. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.