Troubleshooting click
Â
1 - Click not working and script continues
Sometimes, GDSL click commands do not click on the expected element. However, if the script continues, it means that the element has been found.
Here is an example of a script where the click on the expected element does not always work:
waitUntilIdBeforeClick,android:id/button1
pause,500
Solution 1: Make a second click on the element if the first one did not work :
waitUntilIdBeforeClick,android:id/button1
pause,500
if,exists,id,android:id/button1
clickById,android:id/button1
fi
Solution 2: Click on exact text
If you use a clickByText
, use clickByTextExact
. As it is explained in the Text input section, there is probably another element which contains the text that you are looking for and the script clicks on this one.
Solution 2.1: Click on the nth exact text
If there are several elements containing the same exact text, use the function findByTextExact
with the rank parameter to indicates which one you want to put in memory. Then clickOnLastElementFound
.
2 - clickByClass doesn't find my CSS class
Explaination : The automation framework is based on uiautomator. This command lets you click on an element with an android class :
android.widget.EditText
android.widget.Button
android.view.View
This is not to be confused with the CSS classes for web sites or web view.
Solution: Find Android class instead CSS class
When you run a measurement and get an error, you'll have a dump.uix file in your test report. This contains the various android objects that the Chrome application uses to display your website.
You can then search for elements by id, text, class or description.
Â