> ## 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.

# 处理网页弹窗

## 指令说明

**描述：** 在网页操作中，对于不定时出现的弹窗，可以自动检测关闭弹窗或者自定义流程处理。

## 参数说明

<Tabs>
  <Tab title="常规">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-01.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=9dba95af2860e5344b6e94df63b13e2f" alt="处理网页弹窗指令参数面板" width="660" height="326" data-path="helpcenter/commands/web-automation/images/web-popup-handle-01.png" />

    | 参数         | 说明                                                                            |
    | ---------- | ----------------------------------------------------------------------------- |
    | **处理方式**   | 发现指定弹窗后，可选择两种处理方式，一是关闭弹窗，二是执行自定义操作                                            |
    | **弹窗关闭按钮** | 处理方式选择“发现指定弹窗时 - 关闭弹窗”时选取关闭指定弹窗的按钮元素，可通过已捕获的元素或「捕获新元素」来捕获新的网页元素作为按钮目标         |
    | **弹窗元素**   | 处理方式选择“发现指定弹窗时 - 执行自定义操作”时，请指定唯一定位该弹窗的元素，该元素将用于判断弹窗是否出现                       |
    | **处理流程**   | 处理方式选择“发现指定弹窗时 - 执行自定义操作”时填写此参数，即检测到弹窗时要执行的操作，可以理解成发现弹窗的后续处理流程，可选已有的子流程或新增子流程 |
  </Tab>

  <Tab title="高级">
    本指令暂无高级参数。
  </Tab>
</Tabs>

## 使用示例

### 示例1：关闭弹窗

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-02.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=fd60bd60a511ba1c2e7ee6a1499d3274" alt="处理网页弹窗使用示例 - 关闭弹窗流程" width="997" height="380" data-path="helpcenter/commands/web-automation/images/web-popup-handle-02.png" />

**该流程执行逻辑：**

使用【获取已打开的网页对象】指令获取指定浏览器上已打开的网页

使用【处理网页弹窗】指令定义弹窗元素和处理方式，选择"发现指定弹窗时-关闭弹窗"，指定弹窗关闭按钮元素

在后续的RPA执行流程中，遇到定义好的弹窗，RPA会自动关闭对应的弹窗。

#### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-03.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=f5e8b10579a4d4ede744615adad1ce3a" alt="处理网页弹窗使用示例 - 关闭弹窗效果 1" width="1728" height="845" data-path="helpcenter/commands/web-automation/images/web-popup-handle-03.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-04.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=43e5b0ad53670d543cf55f88bb75bc84" alt="处理网页弹窗使用示例 - 关闭弹窗效果 2" width="1100" height="510" data-path="helpcenter/commands/web-automation/images/web-popup-handle-04.png" />

### 示例2：执行自定义操作

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-05.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=feb930dc7c9c9646f4d25ed4e74921dd" alt="处理网页弹窗使用示例 - 自定义操作流程 1" width="1089" height="384" data-path="helpcenter/commands/web-automation/images/web-popup-handle-05.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-06.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=94c311c75f7d5d9c8f7434d3c14ec9fa" alt="处理网页弹窗使用示例 - 自定义操作流程 2" width="787" height="117" data-path="helpcenter/commands/web-automation/images/web-popup-handle-06.png" />

**该流程执行逻辑：**

使用【获取已打开的网页对象】指令获取指定浏览器上已打开的网页

使用【处理网页弹窗】指令定义弹窗元素和处理方式，选择"发现指定弹窗时-执行自定义操作"，"弹窗元素"是被自动检测的元素，如下方案例中的登录提示弹窗，"处理流程"就是【自定义子流程】，在【自定义子流程】做了提示登录的【打开信息对话框】处理

在后续的RPA执行流程中，遇到定义好的弹窗，RPA会出现提示登录的消息对话框。

#### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-07.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=0f3c85cf76068c4f2a9c7104d0e82837" alt="处理网页弹窗使用示例 - 自定义操作效果 1" width="1472" height="907" data-path="helpcenter/commands/web-automation/images/web-popup-handle-07.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/_udziDO1jBiOpIxe/helpcenter/commands/web-automation/images/web-popup-handle-08.png?fit=max&auto=format&n=_udziDO1jBiOpIxe&q=85&s=18157c5715272cc62070a5288c9ef5bb" alt="处理网页弹窗使用示例 - 自定义操作效果 2" width="545" height="238" data-path="helpcenter/commands/web-automation/images/web-popup-handle-08.png" />

### 使用小 Tips

* 目前单个【处理网页弹窗】指令只能处理单个弹窗，如有多个弹窗需要处理，可以多次使用【处理网页弹窗】指令来定义多个弹窗
* 【处理网页弹窗】指令一般可以添加到流程开头，后续流程执行过程中如果界面出现该指令中的指定元素，将会执行关闭操作或者触发自定义操作

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