While testing by Appium (using Python), it clicks on some buttons with a very long delay on some views in my Android app.
The method I am using:

def click_element(self, element, time=wait_time):
    WebDriverWait(self.driver, time).until(
    WebDriverWait(self.driver, time).until(

Does anyone have any idea?

  • it's hard to say looking only at method, it depends on how many elements are on the screen, locator strategy, environment. If you post more details, it would be easier to try to answer your question :)
    – olyv
    Commented Mar 31, 2018 at 5:42

1 Answer 1


It would have been better if you had provided more information in terms of what you were trying to do, whether you were getting an error using this location strategy our were trying, logs, how long it was taking etc. But based on the information you provided let me share couple of ways I fixed timing issues in my selenium script.

  1. Location Strategy-

You are going to have a lot of time delays if you iterate through various tags in the DOM to find and element. This is the reason you may not want to use XPath or probably the location strategy you are trying to use. You are better off,

Step 1 - locating element by id and name.

Step 2 - If Step 1 does not work use class name or tag names

Step 3 - If Step 2 does not work you can use link text or partial text

Step 4 - If you do not have any other option, I would still ask developers to add necessary ids and then finally may use Xpath as my worst and final option.

Since you trying to do automation on the an android app, be default each element should have a "resource-id". So, you should be able to click on any element by the id. You would do something like

driver.find_element(:id, "thelemementid").click()

  1. Wait times

How much wait time were you giving to explicitly make the test wait till the element was located? I am asking because if the wait time is too long then there may actually be an error but you don't know it yet as the test is still running waiting for an element to appear.

  1. How the app is structured

I have had situations where a button layout overlaps with another button and appium is unable to find the button underneath the layout. Because of this you would never be able to click on the button which is getting covered by another button or page on top of it. So you may want to check for how the app layout is structured.

These are some of the things I have done to troubleshoot similar problems you are currently facing.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.