2 Removed irrelevant links, this is not a SEO platform
source | link

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.

-Raj

Testim.io

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.

-Raj

Testim.io

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.

-Raj

1
source | link

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.

-Raj

Testim.io