TopRank Skills

Home / Claw Skills / Autres / selenium-automation
Official OpenClaw rules 15%

selenium-automation

Teaches the agent how to perform advanced web automation using Python, Selenium WebDriver, and ChromeDriver.

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 selenium-automation 技能。 若已安装,则直接安装 selenium-automation 技能。

Overview

Skill Key
gg-erick/selenium-browser-skill
Author
gg-erick
Source Repo
openclaw/skills
Version
-
Source Path
skills/gg-erick/selenium-browser-skill
Latest Commit SHA
5bc0bd16084d50011ed29cc872751279f9ca8a57

Extracted Content

SKILL.md excerpt

# Selenium Automation Skill

You are an expert at web automation using Python and Selenium WebDriver. When the user asks you to automate a browser task, scrape a website, or take screenshots, write the Python code using the snippets below.

## 0. Security and Execution Rules
* **Never run the script automatically.**
* After you write the Python script (for example `automation.py`), you must stop and ask the user for explicit permission to run it.
* Only use the `exec` tool after the user says "yes" or "approved".

## 1. Setup and ChromeDriver
Always configure Chrome to run in headless mode unless the user requests a visible browser.

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

chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")

# Initialize the WebDriver
service = Service()
driver = webdriver.Chrome(service=service, options=chrome_options)
```

## 2. Navigation Commands
Use these commands to open web pages and navigate.

```python
driver.get("[https://example.com](https://example.com)")
driver.refresh()
driver.back()
driver.forward()

current_url = driver.current_url
page_title = driver.title
```

## 3. Taking Screenshots
You can take a screenshot of the entire visible window or a specific HTML element.

```python
driver.save_screenshot("full_page.png")

from selenium.webdriver.common.by import By
element = driver.find_element(By.ID, "main-content")
element.screenshot("element.png")
```

## 4. JavaScript Injections
Use `execute_script` to run custom JavaScript directly inside the browser.

```python
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
page_height = driver.execute_script("return document.body.scrollHeight;")

element = driver.find_element(By.ID, "hidden-button")
driver.execute_script("arguments[0].click();", ele...

Related Claw Skills