agentsclimarketplace

Selenium

Skill pencil20388-eng/browser-automation-skills/skills/selenium

🌐 Drop-in skills that teach Claude Code, Cursor & Codex CLI how to automate browsers. Playwright, Selenium, Puppeteer, Web Scraping, AdsPower & more.From the repository description

Install
npx -y skills add pencil20388-eng/browser-automation-skills --skill selenium

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 1 command, including `pip install selenium`.

SKILL.md

4.0 KB, 949 tokens by cl100k_base, as published. Nobody here has run it

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)

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.