---
title: "performFirstLinkClick"
description: "For a first link matching the [predicate] performs a click on it.

A link in a Text composable is defined by a [LinkAnnotation] of the [AnnotatedString]."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun SemanticsNodeInteraction.performFirstLinkClick(
    predicate: (AnnotatedString.Range<LinkAnnotation>) -> Boolean = { true }
): SemanticsNodeInteraction
```


For a first link matching the `predicate` performs a click on it.

A link in a Text composable is defined by a `LinkAnnotation` of the `AnnotatedString`.



## Code Examples
### touchInputOnFirstSpecificLinkInText
```kotlin
fun touchInputOnFirstSpecificLinkInText() {
    // Example of clicking on a link in test
    composeTestRule.onNodeWithText("YOUR_TEXT_WITH_LINK").performFirstLinkClick {
        (it.item as? LinkAnnotation.Url)?.url == "YOUR_URL"
    }
}
```

