Search code examples
androidappium

How can we click on the link under the given text?


I want to click on the link under the text using Appium + Java

I already use Javascript Executor and TouchAction Class but in Appium 2.2 it was not working and TouchActoin class is also deprecated now so Give me the solution on how to Click On the Link

Here is the screenshot [https://prnt.sc/YJWeojCtROaa]

Only the Login text has a link and the other text is normal text


Solution

  • Use the Below code to click on the specific x and y coordinates of the element.

    PointerInput finger = new PointerInput(Kind.TOUCH,"finger");
        
        Sequence clickposition = new Sequence(finger, 1);
        
        clickposition.addAction(finger.createPointerMove(Duration.ZERO, Origin.viewport(),xcorinate,ycordinate ))
        .addAction(finger.createPointerDown(MouseButton.LEFT.asArg()))
        .addAction(finger.createPointerUp(MouseButton.LEFT.asArg()));
        
        driver.perform(Arrays.asList(clickposition));