This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
29 / 29
Dec 2016

How to Use Tab On Button.
As I was trying the same but it was not possible to me....as I used Keys.TAB and "/t" in Send Keys.

Please let me know how to tab on iOS Element in Appium.
Thanks,
Ajit Jadhav.

yah....its not....if Element is \Hidden and Need to Scroll.....
even its avilable in DOM.

3 months later
3 months later

To find the element X and Y, you can do the following:

WebElement el = driver.findElement("Your element");
Point p = ((Locatable) el).getCoordinates().onPage();
driver.tap(1,p.getX(),p.getY(),1);

Myself, I use a method I've wrote called tapOn :

 public static void tapOn(WebElement element){
        new TouchAction((MobileDriver) getDriver()).tap(element).perform();
    }

I just send him a WebElement. To get it, I use this :

getDriver().findElement(By.xpath(elementSelector))

where the elementSelector is the xPath, found with Appium finder for example.

It makes me able to first get the WebElement in the view, and then create the methods to tap on it.

Hi @Julien_Blanc

What is getDriver() Method here.

I am using like this new TouchAction(((MobileDriver)driver).tap(arg0, arg1, arg2)), and here I am not getting tap() method which takes only one arguement, also perform() method is not coming.

Could you please explain your method in more detail.

Thanks

Yes for sure.

First I've the method getDriver :

public static WebDriver getDriver(){
        return AppiumTest.driver;
    }

It returns the driver, to make actions afterward.

Then each screen of the app is split in two sides : first I get the elements, then I create the methods (actions).

To get the elements, I use the method findElement i've wrote above.
And after, to tap on an element, I've created the method tapOn wrote above too. But getDriver() and tapOn() is wrote in another class accessible for each test.

You want an exemple ?

3 months later

Hello,
I have a query regarding tap function. I wanted to test a touch action on the object that we have created on the canvas . I tried using tap and click but it didn't work me. And I am not able to see the object that I wanted to touch using ui automator. The object was a rectangle created by the 4 lines . Can someone suggest me how to perform touch on this object .

Thanks

You can use x-y coordinates if you know them to tap that region of the screen

Hello ,

Thanks for the reply .I know the coordinates but either of the tap function or long press function is not able to perform the touch on the canvas.

Thanks
Jaswitha

is this app a hybrid app or native app? if your app is a hybrid then you not be able to inspect element using UI automator you can try use chrome remote debugger.

Thanks .It is a native app.I will try chrome remote bugger .The main problem is with touching the object even though i have exact coordinates. I can actually see that it is performing touch by enabling show touches settings option in my tablet .Besides i am not able to see the window that has to be opened after touch is performed.

2 months later

One quick question about the coordinates. Is it correct that when you dump the View Hierarchy from the DDMS and then click on the specific element you get the coordinates?

15 days later

Hi Osamaa

you can get element co-ordinates from the WebElement itself.
Try the below code :
WebElement ele = driver.findElement(By.className("abc"));
Point loc = ele.getLocation();
int x = loc.getX();
int y = loc.getY();
driver.tap(x, ele, y);

Hope this will help :slight_smile:

1 month later
4 months later