This page concerns only measure on android device, if you want to measure on iphone, you can follow this link
Lancer un script gdsl avec le testrunner sur iOS (sans mesure phyique)
With UIAutomatorViewer (recommanded)
Install uiautomatorviewer on your PC
Install Android Studio if you have not
On Android Studio, click on Menu Tools > SDK Manager
Go to SDK tools tab, uncheck option "Hide Obsolete Packages"
Check option “Android SDK Tools” and install version 26.1.1
UIautomatorviewer is now install in android SDK directory
Default path for windows :
c:\USERS\USER\AppData\Local\Android\Sdk\tools\bin (replace USER by your user profile)
Default path for linux :
$home\Android\Sdk\tools\bin
UIAutomatorviewer need a JDK 1.8 by default to work
Launching UIAutomatorviewer without installingd a JDK 1.8 (recommanded)
To avoid installing a different version of java, you could :
set environment variables for your PC profile
Default path for windows | Default path for Linux | ||
---|---|---|---|
ANDROID_HOME | add this variable to precise the path on the sdk android | c:\Users\USER\AppData\Local\Android\Sdk | $home\android\sdk |
JAVA_HOME | add this variable to set the path to the JDK. you can use the jdk installed by android studio | c:\Program Files\Android\Android Studio\jbr if jbr is not present (old version Android Studio, replace by jre) | $home\android-studio\jbr if jbr is not present (old version Android Studio, replace by jre) |
PATH | Complete the path by adding the path to directory containing the java executable. | %JAVA_HOME%\bin | $JAVA_HOME\bin |
After adding the variables, you can open a new terminal (this is important to open a new terminal to take into account the variable you have just set) and use the following command to open uiautomatorviewer :
For windows :
java -Xmx1600M -Dcom.android.uiautomator.bindir="%ANDROID_HOME%\tools" -cp "%ANDROID_HOME%\tools\lib\x86_64\swt.jar":"%ANDROID_HOME%\tools\lib\*" com.android.uiautomator.UiAutomatorViewer
For linux :
java -Xmx1600M -Dcom.android.uiautomator.bindir="$ANDROID_HOME/tools" -cp "$ANDROID_HOME/tools/lib/x86_64/swt.jar":"$ANDROID_HOME/tools/lib/*" com.android.uiautomator.UiAutomatorViewer
The following program appears :
Launching Uiautomatorviewer with installation of JDK 1.8
Could be difficult to have the good jdk version to work with your sdk
On Linux, do this on a new terminal :
# Install java 8 sudo apt-get install openjdk-8-jdk # Check java version java -version # Update the java default version use by your system (if you have several) sudo update-alternatives --config java
On Windows, install Java 8 by getting it on Oracle site web, need to create an account
On Linux, on a new terminal, go to the directory “$HOME/Android/Sdk/tools/bin” and tap the following command :
uiautomatorviewer
On Windows, on a new terminal, go to the directory “C:\Users\[username]\AppData\Local\Android\Sdk\tools\bin” and tap the following command:
uiautomatorviewer.bat
The following program appears :
Using UIAutomatorviewer
when UIAutomatorviewer is opened, you can
Plug your usb on your smartphone
Click on button “Device screenshot”
A screen capture and a dump of view hierarchy appears on the screen
On screenshot (left), you can select the element for which you want to retrieve information and find it on the right:
In this case, the tab “Actu” have the field ‘text’ set with ‘Actu’. So in GDSL we can search the text Actu to find this tab (if there is no other element with the same text in the screen).
Each element of a view can be retrieve by field ‘text’, ‘resource-id’, ‘class’ or ‘content-desc’. GDSL commands are made to find an element by searching on this field
clickById,exampleid : click on an element which have exampleid in resource-id field
waitUntilText,Actu : Wait an element which have ‘Actu’ in text field
Via Accessibility Scanner
An alternative to UIAutomatorviewer could be to use Accessibility Scanner directly on your phone
Download on Playstore on your smartphone
For more information https://support.google.com/accessibility/android/answer/6376570?hl=en