> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 网页自动化

> 自动操作各类网页，包括页面跳转、元素点击、表单填写、数据提取等。

**网页自动化**是八爪鱼 RPA 的核心能力之一。通过内置浏览器或接管已有浏览器，模拟人工实现对网页的各类自动操作。

## 指令能做什么

* **页面操作**：打开网页、前进后退、刷新、关闭标签页
* **元素定位**：通过 XPath、CSS 选择器、文本内容等方式精准定位页面元素
* **数据提取**：从网页中提取文本、链接、图片 URL、表格数据等
* **表单填写**：自动填写输入框、选择下拉框、勾选复选框、上传文件
* **交互模拟**：点击按钮、滚动页面、悬浮鼠标、拖拽元素

## 典型场景

| 场景     | 说明                        |
| ------ | ------------------------- |
| 数据采集   | 批量打开网页，自动提取商品信息、新闻内容、公开数据 |
| 表单批量提交 | 读取 Excel 数据，逐条填入网页表单并提交   |
| 自动化测试  | 模拟用户操作流程，验证网页功能是否正常       |

## 适用场景

* **网页端全流程操作**：用 打开网页 / 点击 / 填写 / 跳转 / 处理弹窗 自动完成网页上的登录、查询、提交。
* **数据采集**：用 数据采集 / 循环相似元素 / 获取相似元素列表 批量抓取列表与详情。
* **高级网页控制**：执行 JavaScript、Cookie 管理、网页截图、XPath 定位、监听网页请求获取接口数据。
* **文件与上传**：文件下载、上传文件，补全网页交互闭环。

## 指令列表

### 网页自动化

<CardGroup cols="2">
  <Card title="打开网页" href="/helpcenter/helpcenter/commands/web-automation/openpagecommand">
    选择某种浏览器类型，如使用八爪鱼浏览器打开网页，以实现网页自动化。
  </Card>

  <Card title="关闭网页" href="/helpcenter/helpcenter/commands/web-automation/closepagecommand">
    关闭已打开的某个或所有网页。
  </Card>

  <Card title="获取已打开的网页对象" href="/helpcenter/helpcenter/commands/web-automation/getopenedpagecommand">
    根据标题或者网站匹配已打开的浏览器页面，供后续流程使用。
  </Card>

  <Card title="点击网页元素" href="/helpcenter/helpcenter/commands/web-automation/web_clickelementcommand">
    点击网页中的按钮、链接或者其他任何网页元素。
  </Card>

  <Card title="等待网页内容" href="/helpcenter/helpcenter/commands/web-automation/waitpagecontentcommand_1">
    在指定的时间内，等待网页内容出现。
  </Card>

  <Card title="鼠标悬停在网页元素上" href="/helpcenter/helpcenter/commands/web-automation/hoverelementcommand">
    移动鼠标，将鼠标悬停在网页中指定的某个元素上。
  </Card>
</CardGroup>

### 网页操作

<CardGroup cols="2">
  <Card title="处理网页弹窗" href="/helpcenter/helpcenter/commands/web-automation/handlepopupcommand">
    在网页操作中，对于不定时出现的弹窗，可以自动检测关闭弹窗或者自定义流程处理。
  </Card>

  <Card title="自动处理网页弹窗" href="/helpcenter/helpcenter/commands/web-automation/autohandlepopupcommand">
    指令运行后，在执行点击、输入等操作时，操作失败后会自动检测元素是否被弹窗覆盖，如果被覆盖则自动隐藏弹窗，确保操作正常执行。
  </Card>

  <Card title="跳转新网址" href="/helpcenter/helpcenter/commands/web-automation/navigatecommand">
    支持在已打开的网页上跳转至新网页、后退、前进、重新加载网页(刷新)。
  </Card>

  <Card title="等待网页加载" href="/helpcenter/helpcenter/commands/web-automation/waitpageloadedcommand_1">
    在指定的时间内，等待网页加载完成。
  </Card>

  <Card title="鼠标滚动网页" href="/helpcenter/helpcenter/commands/web-automation/scrollcommand">
    在指定的网页中滚动鼠标，可以设置为滚动到顶部、底部或者指定位置。
  </Card>

  <Card title="在网页上执行JavaScript函数" href="/helpcenter/helpcenter/commands/web-automation/executejsfunctioncommand">
    在指定的网页中执行一段JavaScript脚本，同时获取脚本的执行结果。
  </Card>

  <Card title="设置cookie" href="/helpcenter/helpcenter/commands/web-automation/setcookiescommand">
    在指定页面预设Cookie值，比如登录Cookie等，可通过Cookie工具获取Cookie。
  </Card>

  <Card title="移除Cookie" href="/helpcenter/helpcenter/commands/web-automation/deletecookiecommand">
    移除指定的或全部Cookie。
  </Card>

  <Card title="获取Cookies" href="/helpcenter/helpcenter/commands/web-automation/getcookiescommand">
    在指定页面或指定URL获取Cookie信息，比如网页登录Cookie等。
  </Card>
</CardGroup>

### 操作网页元素

<CardGroup cols="2">
  <Card title="填写网页输入框" href="/helpcenter/helpcenter/commands/web-automation/web_entertextcommand">
    在网页的输入框中输入内容。
  </Card>

  <Card title="设置下拉框(web)" href="/helpcenter/helpcenter/commands/web-automation/setselectelementoptioncommand">
    设置下拉框选项，仅支持 HTML 源码中 select 标签的下拉框。
  </Card>

  <Card title="设置复选框(web)" href="/helpcenter/helpcenter/commands/web-automation/web_setcheckboxcommand">
    将网页中的复选框状态设置为勾选或不勾选。
  </Card>

  <Card title="获取相关元素" href="/helpcenter/helpcenter/commands/web-automation/web_getrelativeelementcommand">
    主要用于少数无法直接捕获到的网页元素，可通过捕获其父元素、子元素、相邻元素来关联获取。
  </Card>

  <Card title="拖拽元素(web)" href="/helpcenter/helpcenter/commands/web-automation/web_dragelementcommand">
    在指定的网页中将元素拖拽到指定位置。
  </Card>

  <Card title="设置网页元素属性" href="/helpcenter/helpcenter/commands/web-automation/setelementattributecommand">
    用于在网页自动化过程中设置/修改目标元素的属性值，可用于表单填充、状态切换、样式调整等场景。
  </Card>
</CardGroup>

### 数据提取

<CardGroup cols="2">
  <Card title="获取网页信息" href="/helpcenter/helpcenter/commands/web-automation/getpageattributecommand">
    获取网页标题、网址、源代码、文本等信息。
  </Card>

  <Card title="获取网页元素信息" href="/helpcenter/helpcenter/commands/web-automation/getelementattributecommand">
    获取网页元素中的文本内容、元素源代码、元素值、元素链接地址、元素属性、元素位置等信息。
  </Card>

  <Card title="获取相似元素列表(web)" href="/helpcenter/helpcenter/commands/web-automation/web_getsimilarelementscommand">
    在网页中定位一组结构相似的元素并以列表形式返回，可通过可视化捕获、CSS或XPath定位。
  </Card>

  <Card title="网页截图" href="/helpcenter/helpcenter/commands/web-automation/capturecommand">
    对指定网页元素进行截图，并将截图保存至指定文件夹。
  </Card>

  <Card title="XPath获取元素对象" href="/helpcenter/helpcenter/commands/web-automation/getelementobjectcommand">
    可通过自定义写入XPath的方式定位到网页中的指定元素。
  </Card>

  <Card title="获取下拉框选项(web)" href="/helpcenter/helpcenter/commands/web-automation/getselectelementoptionscommand">
    获取网页中下拉框的选项，仅支持 select 标签下拉框。
  </Card>

  <Card title="数据采集" href="/helpcenter/helpcenter/commands/web-automation/extractdatacommand">
    此指令可批量提取界面中的表格、结构化数据，支持多种数据提取模式。
  </Card>

  <Card title="开始监听网页请求" href="/helpcenter/helpcenter/commands/web-automation/startmonitornetworkcommand">
    开始监听，后续可使用"获取网页请求结果"指令获取监听到的数据。
  </Card>

  <Card title="获取网页监听结果" href="/helpcenter/helpcenter/commands/web-automation/getmonitorresponsecommand">
    获取网页监听的结果。
  </Card>

  <Card title="停止监听网页请求" href="/helpcenter/helpcenter/commands/web-automation/stopmonitornetworkcommand">
    必须和开始监听网页请求指令配合使用，不能单独使用，表示停止对网页监听。
  </Card>
</CardGroup>

### 对话框处理

<CardGroup cols="2">
  <Card title="文件下载" href="/helpcenter/helpcenter/commands/web-automation/downloadcommand">
    自动完成点击下载按钮、在文件保存对话框中输入保存文件信息等系列操作。
  </Card>

  <Card title="上传文件" href="/helpcenter/helpcenter/commands/web-automation/uploadcommand">
    自动完成点击上传按钮、在文件选择对话框中输入待上传文件等系列操作。
  </Card>
</CardGroup>

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
