Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to click/tap on a link embedded in a text message using Appium?

Please refer to the below screenshot. It shows an SMS message in Android Messages that includes an embedded link.

SMS message with embedded link

While the attribute for the associated android.widget.TextView class is clickable, manual tests show that clicking on the regular text in the message does not activate the link. Only when directly clicking on the link will the browser open.

In the Appium script, using the click() method on the element does not successfully click on the link (unless the link is centered within the element).

Does anyone have suggestions?

like image 324
mc-sm9 Avatar asked Dec 07 '25 10:12

mc-sm9


1 Answers

A possible solution that works reliably for me with Appium is to use the TouchAction with tap and specify the coordinates of where the link appears on your phone's screen. Here's some sample code:

TouchAction touchAction = new TouchAction(driver);
touchAction.tap(PointOption.point(x_coordinate, y_coordinate)).perform();

You would define integer variables for the specific x & y coordinates, according to your needs.

like image 124
toasty Avatar answered Dec 09 '25 22:12

toasty