admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

How to .click() on Android Dialog's button ? #498

Closed pacozaa closed 6 years ago

pacozaa commented 6 years ago

I have been used .click() with normal element for a while but when it comes to button on Android Dialog seems like it doesn't click but it gives me no error.

it("should press signin", function () {
    return driver      
      .elementById("app.udrinkidive.feed2us.com.customer:id/Done")
      .click() 
      .sleep(10000)     
      .elementById("app.udrinkidive.feed2us.com.customer:id/dBtnOK") 
      .click()
      .sleep(10000)            
  });

As above code I tried to delay click() by using sleep(1000). Still not working.

Please help :)

pacozaa commented 6 years ago

I have found the solution myself

.elementsByAndroidUIAutomator(
 'new UiSelector().resourceId("app.udrinkidive.feed2us.com.customer:id/dBtnOK")'
 , function(err, els){        
 els[0].click()        
})