agentleFS
pencil20388-engpencil20388-eng/browser-automation-skills/skills/selenium/SKILL.md

selenium

Skill5 starsChanged 6 months agoMITView on GitHub

Automate browsers with Selenium — the most widely-used browser automation framework. Selenium 4.6+ includes automatic driver management (no manual ChromeDriver download needed). Prefer By.CSS_SELECTOR — it's faster and more readable than XPath.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. G1Joshi/Agent-Skills★ 15same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer By.CSS_SELECTOR — it's faster and more readable than XPath.

    line 127
  2. Very specific:

    Always call driver.quit() when done to prevent zombie Chrome processes

    line 140
  3. Very specific:

    Use find_elements (plural) when you expect multiple results.

    line 142

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Selenium WebDriver Automation Skill

Automate browsers with Selenium — the most widely-used browser automation framework.

Installation

pip install selenium

Selenium 4.6+ includes automatic driver management (no manual ChromeDriver download needed).

Core Patterns

Open a page

from selenium import webdriver

driver = webdriver.Chrome()  # Auto-downloads matching ChromeDriver
driver.get("https://example.com")
print(driver.title)
driver.quit()

Headless mode

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)

Find elements and interact

from selenium.webdriver.common.by import By

driver.find_element(By.ID, "username").send_keys("my_user")
driver.find_element(By.ID, "password").send_keys("my_pass")
driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()

Wait for elements

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

element = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.CSS_SELECTOR, ".results"))
)

# Wait for clickable
button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.ID, "submit"))
)
button.click()

Extract data

heading = driver.find_element(By.TAG_NAME, "h1").text
link = driver.find_element(By.CSS_SELECTOR, "a.profile").get_attribute("href")
items = driver.find_elements(By.CSS_SELECTOR, ".product-card")
for item in items:
    name = item.find_element(By.CSS_SELECTOR, ".name").text
    price = item.find_element(By.CSS_SELECTOR, ".price").text

Screenshots

driver.save_screenshot("screenshot.png")
element = driver.find_element(By.ID, "chart")
element.screenshot("chart.png")

Execute JavaScript

driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
result = driver.execute_script("return document.title")

Connect to existing browser (debug port)

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

options = Options()
options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
driver = webdriver.Chrome(options=options)

Manage cookies

cookies = driver.get_cookies()
driver.add_cookie({"name": "key", "value": "val"})
driver.delete_all_cookies()

Multiple tabs

driver.execute_script("window.open('https://example.com', '_blank')")
driver.switch_to.window(driver.window_handles[1])  # Switch to new tab
driver.switch_to.window(driver.window_handles[0])  # Back to first tab

Locator strategies

StrategyExample
By.IDfind_element(By.ID, "email")
By.CSS_SELECTORfind_element(By.CSS_SELECTOR, "div.card > h2")
By.XPATHfind_element(By.XPATH, "//button[contains(text(),'Submit')]")
By.CLASS_NAMEfind_element(By.CLASS_NAME, "product-title")
By.TAG_NAMEfind_elements(By.TAG_NAME, "li")
By.LINK_TEXTfind_element(By.LINK_TEXT, "Click here")

Prefer By.CSS_SELECTOR — it's faster and more readable than XPath.

Common errors

ErrorFix
"SessionNotCreatedException"Chrome and ChromeDriver version mismatch; update Selenium to 4.6+ for auto-management
"NoSuchElementException"Element doesn't exist or hasn't loaded; use WebDriverWait
"ElementNotInteractableException"Element exists but can't be clicked; scroll to it or wait for visibility
"StaleElementReferenceException"Page has changed since element was found; re-find the element

Important notes

  • Always call driver.quit() when done to prevent zombie Chrome processes
  • Selenium does NOT auto-wait; always use WebDriverWait for dynamic content
  • Use find_elements (plural) when you expect multiple results; it returns [] instead of raising an error
  • For Selenium 4.x, use Service class: webdriver.Chrome(service=Service(path), options=options)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.