UiPath Documentation
activities
latest
false

用户界面自动化活动

上次更新日期 2026年5月8日

单击

单击指定的用户界面元素,例如按钮或链接。 可以配置为使用任何鼠标键,使用双击。

必须在“打开”“附加”之后添加此 API。

定义

命名空间:UiPath.UIAutomationNext.API.Models

程序集:UiPath.UIAutomationNext.API.Models(位于 UiPath.UIAutomationNext.API.Models dll 中)

重载

重载描述
Click(String, ClickOptions)单击“对象存储库”中由字符串标识的用户界面元素。
Click(IElementDescriptor, ClickOptions)单击由对象存储库中元素描述符标识的用户界面元素。
Click(TargetAnchorableModel, ClickOptions)单击目标可锚定模型,该模型表示应用程序中的特定用户界面元素。
Click(RuntimeTarget, ClickOptions)单击由对象存储库元素的运行时实例标识的用户界面元素。
Click(String, NClickType, NMouseButton)对对象存储库中由字符串标识的用户界面元素执行单击操作,并指定单击类型和鼠标键。
Click(IElementDescriptor, NClickType, NMouseButton)单击由对象存储库中元素描述符标识的用户界面元素,并指定单击类型和鼠标键。

Click(String, ClickOptions)

单击由字符串表示形式标识的用户界面元素。

Click(
    TargetAnchorableModel target, 
    ClickOptions clickOptions)
Click(
    TargetAnchorableModel target, 
    ClickOptions clickOptions)

target String :指示在对象存储库中捕获且要单击的用户界面元素。

clickOptions ClickOptions :用于自定义单击操作的其他选项:

* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType
  CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode
  NInteractionMode`:
  + `HardwareEvents` - Simulates the click
    by using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode
    as the Open or Attach APIs. This is the default
    selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.
* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType
  CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode
  NInteractionMode`:
  + `HardwareEvents` - Simulates the click
    by using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode
    as the Open or Attach APIs. This is the default
    selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/zh-CN/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.

Click(IElementDescriptor, ClickOptions)

单击由对象存储库中元素描述符标识的用户界面元素。

Click(
    IElementDescriptor elementDescriptor,
    ClickOptions clickOptions)
Click(
    IElementDescriptor elementDescriptor,
    ClickOptions clickOptions)

elementDescriptor IElementDescriptor :要单击的用户界面元素,由对象存储库中元素的描述符标识。

clickOptions ClickOptions :用于自定义单击操作的其他选项:

* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType
  NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType
  CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode
  NInteractionMode`:
  + `HardwareEvents` - Simulates the click
    by using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode
    as the Open or Attach APIs. This is the default
    selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.
* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType
  NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType
  CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode
  NInteractionMode`:
  + `HardwareEvents` - Simulates the click
    by using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode
    as the Open or Attach APIs. This is the default
    selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/zh-CN/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.

Click(TargetAnchorableModel, ClickOptions)

单击目标可锚定模型,该模型表示应用程序中的特定用户界面元素。

Click(
    TargetAnchorableModel target, 
    ClickOptions clickOptions)
Click(
    TargetAnchorableModel target, 
    ClickOptions clickOptions)

target TargetAnchorableModel :要单击的目标可锚定模型(用户界面元素)。

clickOptions ClickOptions :用于自定义单击操作的其他选项:

* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode NInteractionMode`:
  + `HardwareEvents` - Simulates the click by
    using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode as the
    Open or Attach APIs. This is the default selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.
* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode NInteractionMode`:
  + `HardwareEvents` - Simulates the click by
    using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode as the
    Open or Attach APIs. This is the default selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/zh-CN/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.

Click(RuntimeTarget, ClickOptions)

单击由对象存储库元素的运行时实例标识的用户界面元素。

Click(
    RuntimeTarget target,
    ClickOptions clickOptions)
Click(
    RuntimeTarget target,
    ClickOptions clickOptions)

target RuntimeTarget :要单击的用户界面元素,由对象存储库元素的运行时实例标识。

clickOptions ClickOptions :用于自定义单击操作的其他选项:

* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType
  NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType
  CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode
  NInteractionMode`:
  + `HardwareEvents` - Simulates the click
    by using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode
    as the Open or Attach APIs. This is the default
    selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.
* `KeyModifiers NKeyModifiers`:
  + `None`
  + `Alt`
  + `Ctrl`
  + `Shift`
  + `Win`
* `ClickType
  NClickType`:
  + `Single`
  + `Double`
  + `Down`
  + `Up`

  For example, to perform a double click you just need to set
  the click type to
  `NClickType.Double`:

  `clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest,
  new ClickOptions(){ClickType =
  NClickType.Double}.WithVariable("account_number_system1",
  "407547"));`.
* `MouseButton NMouseButton`:
  + `Left`
  + `Right`
  + `Middle`
* `CursorMotionType
  CursorMotionType`:
  + `Instant` - The cursor jumps to the
    destination.
  + `Smooth` - The cursor moves in
    increments.
* `InteractionMode
  NInteractionMode`:
  + `HardwareEvents` - Simulates the click
    by using the hardware driver. This is the slowest API, it
    cannot work in the background, but it is compatible with all
    desktop apps.
  + `SameAsCard` - Use the same input mode
    as the Open or Attach APIs. This is the default
    selection.
  + `Simulate` - Simulates the click using
    accessibility APIs. Recommended in browser automation, Java
    apps, or SAP. More reliable than Hardware Events. Works even
    if the target application is not in focus. Please test if
    your target application UI element supports this.
  + `DebuggerApi` - Performs actions using
    debugger APIs. Works for Chromium elements only. Sends all
    text in one go. Works even if the target application is not
    in focus. For more details, check out this [page](https://docs.uipath.com/zh-CN/studio/standalone/2023.10/user-guide/chromium-api).
  + `WindowMessages` - Simulates using Win32
    messages. Recommended for desktop apps. Usually more
    reliable than Hardware Events. Sends all text in one go.
    Works even if the target application is not in focus. Before
    using this API, please test if your target application UI
    element supports this.

Click(String, NClickType, NMouseButton)

对由字符串表示或选取器标识的用户界面元素执行单击操作,并指定单击类型和鼠标键。

Click(
    string target, 
    NClickType clickType, 
    NMouseButton mouseButton)
Click(
    string target, 
    NClickType clickType, 
    NMouseButton mouseButton)

target String :指示在对象存储库中捕获且要单击的用户界面元素。

clickType NClickType :要执行的单击类型:单击双击向下向上。默认选项为“单击”。:例如,要执行双击,您只需将单击类型设置为NClickType.Double : clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest, new ClickOptions(){ClickType = NClickType.Double}.WithVariable("account_number_system1", "407547"));

mouseButton NMouseButton :单击时常用的鼠标键:左(左)中(中)右(右) 。默认选项为“左侧”。

Click(IElementDescriptor, NClickType, NMouseButton)

单击由对象存储库中元素描述符标识的用户界面元素,并指定单击类型和鼠标键。

Click(
    IElementDescriptor elementDescriptor,
    NClickType clickType, 
    NMouseButton mouseButton)
Click(
    IElementDescriptor elementDescriptor,
    NClickType clickType, 
    NMouseButton mouseButton)

elementDescriptor IElementDescriptor :要单击的用户界面元素,由对象存储库中元素的描述符标识。

clickType NClickType :要执行的单击类型:单击双击向下向上。默认选项为“单击”。:例如,要执行双击,您只需将单击类型设置为NClickType.Double : clientAccountsScreen.Click(Descriptors.ACME_System_3.ClientAccountsScreen.AccountRowTest, new ClickOptions(){ClickType = NClickType.Double}.WithVariable("account_number_system1", "407547"));

mouseButton NMouseButton :单击时常用的鼠标键:左(左)中(中)右(右) 。默认选项为“左侧”。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新