1

I am using appium for automating sencha app for iOS. App has div button which is not detected by appium inspector. I have already tried with different techneques like by name, class, CSS selector but its not worked at all.

Can any one please help me on this.

Sumit Jain
  • 11
  • 1
  • please share relevant code that you have tried so far – Bhushan Kawadkar Sep 10 '14 at 08:48
  • Just to brief the issue again - My App has tool bar that has some buttons (icons only). While recording its neither recognizing tool bar nor buttons but if we place any text or text button then its recognized Here is the codes I followed to detect manually By Name - wd.findElement(By.name(“Logbutton")).click(); By Class - wd.findElement(By.className(“.logclass")).click(); By ID - wd.findElement(By.id(“logid")).click(); By CSS Selector - wd.findElement(By.cssSelector(".button-log-interaction-phone")).click(); But none of above is working – Sumit Jain Sep 12 '14 at 06:51

2 Answers2

0

By Name - wd.findElement(By.name(“Logbutton")).click();

By Class - wd.findElement(By.className(“.logclass")).click();

Sounds like this is a wd class name and not Sencha Touch class name

By ID - wd.findElement(By.id(“logid")).click();

Leave it to Sencha to add ID to the divs. Not a real good way to find your item

By CSS Selector - wd.findElement(By.cssSelector(".button-log-interaction-phone")).click();

Sencha adds "x-button" to the button. In addition you can add cld:'logclass', but I suppose that would not be the way to do it

Solution

wd is only one namespace. What you need is the Ext namespace and from there it's easy:

var btn = Ext.Viewport.down('#myButton');
btn.fireEvent('tap', btn);
Dinkheller
  • 4,631
  • 5
  • 39
  • 67
0

I am able to do tap or click on a div or button etc by the following way.

    Point p = button.getLocation();        
    p = p.moveBy((button.getSize().getWidth() / 2), (button.getSize().getHeight() / 2));
    WebElement button = driver.findElement(By.id("someid"));
    HashMap<String, Double> clicks = new HashMap<String, Double>();
    clicks.put("tapCount", 2d);
    clicks.put("touchCount", 1d);
    clicks.put("duration", 2d);
    clicks.put("x", new Double(p.getY()));
    clicks.put("y", new Double(p.getX()));
    ((JavascriptExecutor) driver).executeScript("mobile: tap", clicks);
Raghu K Nair
  • 3,854
  • 1
  • 28
  • 45