How can i click on text link inside of textview(android and ios both)

Hey folks,
plz help me its urgent.
I have one text “*Premium quality data is based on physicians assessed by the UnitedHealth Premium program. For more information on the premium program,click here "
How can I click on link"click here” inside TextView?
the problem is I am using by content description and it is same for all the content on the page there are four content on the page with same content description. I used this code but its not working…
WebElement element = driver.findElement(getElement(“AboutDoctorondemandPage.Content.Label”));
Point point = element.getLocation();
int x = point.x +1;
int y = point.y + element.getSize().getHeight() - 1;
new TouchAction(driver).tap(x, y).perform();

here is the screenshot

You meant you coudn’t click on the link by using: driver.findElement(By.linkText(“click here”)); ?

not by content description see the screenshot.

driver.findElement(By.xpath("//android.widget.TextView[@content-desc=‘THE_CONTENT_HERE’]")).click();

these details is for whole text "Premium quality data is based on physicians assessed by the UnitedHealth Premium program. For more information on the premium program,click here ".

Could you possibly use the UIAutomator and click on the [click here] for the detail, pls~

I just installed the app on my Android and could guess the issue that you are facing.

Please:

  1. Use UIAutomator, move the cursor into the [Click here] at its center, get the co-ordinate
  2. Use below code to interaact on the [click here]

String originalContext = driver.getContext();
driver.context(“NATIVE_APP”);
driver.tap(1, YOUR_X, YOUR_Y, 200);
driver.context(originalContext );

I tried my best as you’re urgent. Please give a try.

Above is just an example.

It works man thank you so much buddy I really appreciate that.

So happy when hearing that man. (y)

hey that’s work but I have one thing to discuss see we will put coordinate but that coordinate differ device to device…so it will work on particular device through which we will take the coordinate but not with others…

Very good question. I have been waiting for that!

Actually that approach should be the last solution you should apply during finding out the better one. The reason is very clear as you mentioned. We have many devices with different screen size, even if on same device with Portrait/landscape.

if you have less device, you can control that by using switch (String UDID) case: return the location for those elements.
If you have a lot of devices, that should be nightmare!

So, as I mentioned, you need to find another better approach (if you can).

btw, I installed the app yesterday, but I couldn’t find out the [Virtual visits] screen. So I tried to find a similar screen as you see.

Could you possibly share the steps to go to that screen. I will try to play around with it.

yeah sure,there are navigation bars in the bottom of screen
1.click on search
2.click on virtual visit
3.click on doctor on demand
4.there are two click here …try the one with second click here

I was struggling at the step 01. Where is the search?

I installed this app: http://www.doctorondemand.com/

Is it same at your?

The last one what I could find out in the worse case.

  1. Create a Method name: tapAround with the logic as below:

    // This is the original code
    String originalContext = appiumDriver.getContext();
    Point coordinate = element.getLocation();
    Dimension dms = element.getSize();
    int centerX = dms.getWidth() / 2 + coordinate.getX();
    int centerY = dms.getHeight() / 2 + coordinate.getY();
    appiumDriver.context(“NATIVE_APP”);
    appiumDriver.tap(1, centerX, centerY, 200);
    appiumDriver.context(originalContext);

//You need to implement it to touch around X, Y with shift-amount
// The signal to make it successfully should be something on the screen after click on the link

The ideal mean you will click around till successfully.
Base on that, you can use it on any devices.