> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/navigation/get-url.md).

# 获取URL

获取 URL 是一个用于提取当前在浏览器中打开的网页的完整地址 (URL) 并将其存储到一个变量中的操作。

#### 配置参数：

* 输出变量：您自定义的变量名称，用于存储成功提取后的网页地址字符串。

#### 实际示例：检查成功登录后的重定向状态

当您编写自动登录脚本 (Login) 到某个平台（例如 Pinterest 或 Facebook）时。在填写信息并点击登录按钮后，您想检查账户是否成功进入主页，还是被重定向到错误页面/身份验证检查页面 (Checkpoint)：

* 配置方法：
  * 在点击登录按钮后等待几秒钟，调用获取 URL 操作。
  * 输出变量：将变量命名为 `currentLink`。
  * 结合在后面插入 If 条件语句来检查变量 `$currentLink` 的数据：
    * *情况 1*：如果变量 `$currentLink` 包含短语 `checkpoint` 或 `login_error` ➔ 脚本识别账户错误并处理停止流程。
    * *情况 2*：如果变量 `$currentLink` 包含短语 `home` 或数据转到个人页面 ➔ 脚本识别成功登录并继续执行账户维护任务。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/navigation/get-url.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
