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

# 条件判断

> 根据条件的成立与否，控制流程走向不同分支，实现智能决策逻辑。

**条件判断**类指令帮助你根据数据或页面状态自动选择执行路径，让流程具备"判断力"。

## 适用场景

* **根据页面/窗口状态分支**：打开网页后判断“是否包含登录入口”，已登录直接采集、未登录先走登录分支。
* **多条件组合决策**：用 If 多条件 实现“手机号格式正确 且 已勾选协议”才提交，或“A 或 B”任一满足即执行。
* **执行前路径校验**：写入文件前用 If 文件存在 / If 文件夹存在 判断目标路径，避免流程因路径缺失报错中断。
* **流程兜底与默认处理**：所有正常分支都不满足时，用 Else / Else If 兜底提示“未匹配到任何条件”或执行默认动作。
* **动态元素判断**：用 If 元素可见 判断弹窗、广告是否出现，决定关闭弹窗还是继续后续操作。
* **校验结果做流程开关**：文件/图片校验（If 文件存在 / If 图片存在）通过后进入下一步，未通过则走告警或重试分支。

## 指令列表

<CardGroup cols="2">
  <Card title="If 条件" href="/helpcenter/helpcenter/commands/condition/ifcommand">
    判断指定条件是否成立，成立则执行内部指令块。
  </Card>

  <Card title="If 多条件" href="/helpcenter/helpcenter/commands/condition/ifmulticonditioncommand">
    同时判断多个条件（且/或关系），全部或多选一满足时执行。
  </Card>

  <Card title="Else" href="/helpcenter/helpcenter/commands/condition/elsecommand">
    所有前置条件均不成立时执行的兜底分支。
  </Card>

  <Card title="Else If 条件" href="/helpcenter/helpcenter/commands/condition/elseifcommand">
    前置条件不成立时，继续判断另一个条件。
  </Card>

  <Card title="Else If 多条件" href="/helpcenter/helpcenter/commands/condition/elseifmulticonditioncommand">
    前置条件不成立时，继续判断多个条件。
  </Card>

  <Card title="End If" href="/helpcenter/helpcenter/commands/condition/endifcommand">
    标记 If 条件块的结束，与 If 配对使用。
  </Card>

  <Card title="If 页面包含" href="/helpcenter/helpcenter/commands/condition/ifpagecontainscommand">
    判断当前页面是否包含指定文本或元素。
  </Card>

  <Card title="Else If 页面包含" href="/helpcenter/helpcenter/commands/condition/elseifpagecontainscommand">
    前置条件不成立时，判断页面是否包含指定文本。
  </Card>

  <Card title="If 元素可见(web)" href="/helpcenter/helpcenter/commands/condition/ifelementvisibilitymatchcommand">
    判断指定网页元素是否可见或匹配。
  </Card>

  <Card title="Else If 元素可见(web)" href="/helpcenter/helpcenter/commands/condition/elseifelementvisibilitymatchcommand">
    前置条件不成立时，判断元素是否可见或匹配。
  </Card>

  <Card title="If 窗口存在" href="/helpcenter/helpcenter/commands/condition/ifwindowexistscommand">
    判断指定窗口/应用是否存在。
  </Card>

  <Card title="If 窗口包含" href="/helpcenter/helpcenter/commands/condition/ifwindowcontainscommand">
    判断指定窗口是否包含某文本或元素。
  </Card>

  <Card title="Else If 窗口包含" href="/helpcenter/helpcenter/commands/condition/elseifwindowcontainscommand">
    前置条件不成立时，判断窗口是否包含某文本。
  </Card>

  <Card title="If 文件存在" href="/helpcenter/helpcenter/commands/condition/iffileexistscommand">
    判断指定路径的文件是否存在。
  </Card>

  <Card title="If 文件夹存在" href="/helpcenter/helpcenter/commands/condition/iffolderexistscommand">
    判断指定路径的文件夹是否存在。
  </Card>

  <Card title="If 图片存在" href="/helpcenter/helpcenter/commands/condition/ifimageexistscommand">
    判断指定区域的图片是否存在或匹配。
  </Card>
</CardGroup>

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