DSPy a system for AI to Write Prompts and Do Fine Tuning
Appium
1. INSTALLING AND UNDERSTANDING APPIUM:
1.
1. Go to http://developer.android.com/sdk/index.html , scroll down the page to “Other
Download options” and click on the Download link for the desired platform.
2. You can also download the entire bundle : Eclipse+ADT Plugin. Click on “Download on
other platform” link. (recommended for new users who don’t have eclipse)
3. Download the zip file for windows sdk tools
4. Extract to any directory you wish to install sdk.
5. From the list of “Android SDK Manager” packages check the checkbox for the below
mentioned points and click on “ Install xx Packages..”
● Get the latest SDK tools: Under Tools, install Android SDK Tools, Android SDK Platform
tools and Android SDK Build Tools.
● Get the Android API: Select different Android versions and APIs for AVDs. These are the
different environments for your application under test. You can choose multiple from Android
4.4.2 to the latest.
● Get the Extras: Install the default selections as well as the “Intel x86 Emulator Accelerator
(HAXM installer)”.
6. Now download the plugin for eclipse.
7. Go to eclipse, click on Help menu→ Install new software. In the “work
with” text box type url “https://dl-ssl.google.com/android/eclipse”. Now check
the checkbox for “Developers tool” and “NDK plugins”(if available)
8. Click on next and then follow steps as it appears. Now restart your eclipse.
9. Once you restart your eclipse you will get a pop up saying “Location of Android SDK has
not been setup in preferences”. Click on “open preferences”
10. In the pop up that appears browse for the location of SDK where you have installed it.
Click on apply.
11. After all the installation is done, verify if SDK Manager is installed successfully. To verify,
click on Windows in the menu bar in eclipse, you will see “Android SDK Manager”,
“Android Virtual Device Manager” in the option which confirms that the installation is
complete.
12. Now we are ready to Start a android project in eclipse.
13. Click on Project→ Others→ Android Folder → Android Application
Project→ Next
Setting the ANDROID_HOME Variable on Windows:
1. After you have installed SDK successfully, we now need to set up the ANDROID_HOME
environment variable for the SDK.
2. Control Panel -> System or Security –> System; the same thing can be done by right-clicking
on ‘MyComputer’ and choosing Properties.
3. Choose ‘Advanced system settings‘.
2. 4. Under the Advanced tab Choose the ‘Environment Variable…‘ option.
5. Select New In the System variables.
6. Define the Variable name as ‘ANDROID_HOME‘ and Variable value as ‘C:Userspath to
android-sdk‘.
Setting PATH Variables for Android SDK
1. Now we need to specify the ‘tools‘ folder location in the PATH variable of android sdk
package. For PATH, most probably it will already exists in your machine. So just select it and
choose the Edit option.
2. In the editor add the value ‘;%ANDROID_HOME%tools‘ or ‘;C:Userspath to android-
sdktools‘.
3. Now we need to specify the ‘platform-tools‘ folder location in the PATH variable of android
sdk package. Select the Path variable and choose the Edit option.
4. In the editor add the value ‘;%ANDROID_HOME%splatform-tool‘ or ‘;C:Userspath to
android-sdkplatform-tools‘.
5. After restarting command prompt type ‘android‘ in the command prompt
6. It will open the Android SDK Manager.
How to Download And Install Appium Desktop Client
1. Go to http://appium.io/downloads.html page and to install the Appium Desktop client cllick
on Appium.exe for Windows to download the ‘.exe‘ file for Appium.
2. Go with the latest version of Appium.
3. After saving the zip file at the desired location, unzip the Zip file and extract the Appium
folder on the same location to access the .exe file. Double click on the Appium folder.
4. Double click the Appium Installer to start the installation process. A pop up window will
display to select the appropriate language. Leave it as it is and click on OK.
5. The installation process starts. Click the Next button to continue the installation.
6. After the initial installation is done, window will ask you where you want to install the
Appium. You can choose to change where you want to keep your folder but it’s best to stick
with what you were given first. Click Next to continue.
7. Click Next and then on Install
8. After the successful installation Appium will open up
How to Enable Developer Mode / Options on Android Phone or Tablet
This is two step process , first step is to Enabling Developer Mode Options on Android Phone or
Tablet and second is to Switch On the USB Debugging of the device.
Step 1: Enable Developer Options
1. Tap on the Main Menu icon.
2. Go to the Settings.
3. Scroll down to ‘About phone‘ and tap on it.
4. Scroll down to the bottom again, where you see ‘Build number’ (Your build number may
vary). Tap On Build number Seven (7) times. After the third tap, you’ll see a playful dialog
3. that says you’re four taps away from being a developer. Keep on tapping, and *poof*, you’ve
got the developer settings options.
5. You can notice the Developer Options in the Additional settings option.
Step 2: Switch On USB Debugging
1. Go to the Developer Options.
2. Tick the USB Debugging check box.
3. It may display the Pop Up message, if Yes simply click OK.
4. And it’s done, you can see the USB Debugging is ON now.
Install PdaNet to Connect with Android Device
PdaNet is a free app (available for iPhone, Android, BlackBerry, and other mobile platforms) that you
can use to turn your smartphone into a modem for your laptop or you can say that it enables
tethering. But we do not need this software to enable tethering but this application will help us to
connect our computer with the mobile devices using USB cables. To use the PdaNet app for
connecting your Android phone, you need to install the app on both your Android phone and also
install the software on the Windows computer (Windows XP, Vista, Windows 7 — 32-bit and 64-bit
versions available) or Mac OS.
How to Install PdaNet to Connect with Android Device:
1. Download PdaNet from http://pdanet.co/a/. - Download this app for your system.
2. Double click the file you just downloaded to start the process if installation
3. To run the installer, click Run.
4. The installation process starts. Click the Next button to continue the installation.
5. Select the ‘I accept the agreement‘ radio button and proceed with the installation.
6. Click on Next >.
7. Click with the default values in the fields that appears.
8. Now, select your device make and proceed by clicking OK button.
9. Now it will ask you to install Google USB Android Phone, please click on Install.
10. Now download PDANet+ from your mobile play store and install in your device
11. Installation is done on your computer and your device is also attached with your computer.
Click on Finish.
Verify if the device is connected to system via Appium:
1. Run “adb devices” from command prompt of your system. It will list down all the devices
connected. This device name is the binary name of your device
2. Also, you can verify the same from the “Device manager” of your system. In the device
manager under the “Adb Device” you can see your device connected.
How to Set Up Appium Project in Eclipse
Following steps needs to be done to Set Up Appium Project in Eclipse and before running first
Appium Mobile Automation script:
4. ● Download GSon jar files from
● Download Selenium WebDriver Java Client
● Add Gson jars to Project
● Add Selenium Jars to project
● Add Java Client to project
First Appium Test to Launch Amazon App
This will include some steps:
● Launch Appium Node server
● Create your first test script
● Execute your first test
Launch Appium Node Server -
1. Open appium by double clicking on appium.exe present in the appium directory. There
are different icons present on the appium screen which is described as below:
● Android Icon is for Configuration settings
● Settings Icon is for General Settings
● Play Icon is for Starting Node server
2. Click on Android icon to open the configuration of the Appium run. There you need to select the
check box of ‘No Reset‘. This will ensure that the Appium will not install or uninstall App on every
run.
3. Click on General Setting icon and make sure that Server Address and Port is populated. Do not
alter the IP address or port number. Your Appium console start at 127.0.0.1:4723
4. Now click on the Launch Appium Node Server button on the top right corner of Appium window
and wait for few seconds. Appium server started and running on your system. You can also start
appium server from command line using “adb start-server”
Now you are all good to run The First Test
● You need to set DesiredCapabilities to test in the actual device. Desired Capabilities are a
set of keys and values sent to the Appium server to tell the server what kind of automation
session we’re interested in starting up. There are also capabilities used to modify the
behavior of the server during automation.
How to find the appPackage and appActivity for APK file?
5. 1. Click on the android icon present on the Appium Client window to open the configuration
settings.
2. Check the Application Path check box.
3. Click on Choose button to locate your apk file, in this case I have given it Amazon apk.
OR
1. Install apk info app in your mobile, this app list down the appPackage and appActivity
for all the apps installed in your phone. You can look for the appPackage and appActivity
information from this app. For APK file info, install APK extractor app in
your phone, look for the app whose apk file info you need, tap on the
app and the apk file will be saved in “ES Explorer → Extracted APKs”.
You can copy the apk file from here and paste in the desired location
in your system.
You would require all the above information to feed in the testcase using setCapability
method.
Ways to identify UI elements in mobile apps
1. uiautomatorviewer
2. Appium inspector
uiautomatorviewer : Mobile’s Firebug
The uiautomatorviewer is GUI tool to scan and analyze the UI components of an Android
application. It provides a convenient visual interface to inspect the layout hierarchy and view
the properties of the individual UI components that are displayed on the test device.
How to use a uiautomatorviewer(Explained using calculator application)
1. Connect Android device to the PC using a USB cable and enable USB debugging option
from “Settings -> Developer options” .
2. Launch your test application manually by tapping on the application icon
6. 3. Now open command prompt, navigate to your $android-sdk/tools directory and hit
command uiautomatorviewer. This command will open an empty uiautomatorviewer
window.
4. Click on Device Screenshot or Device Screenshot with Compressed Hierarchy option
(2nd and 3rd option in upper left corner). You will get screenshot of currently open view
of app on your device.
5. Now we have index, text, resource-id,class, package and other info. You can use
resource-id of element in script to locate element by id (In our case resource-id of key
6 is “com.android2.calculator3:id/digit6”)
6. If any element does not have id then use xpath to locate the element. (Let’s consider
after tapping on key 6 you want to assert text 6).
7. To write your xpath:
a. Start with the class //class
b. Add attributes @attribute=”attribute_value”
E.g.: XPath to identify the text 8 in the calculator app is
“//android.widget.EditText[@index=0]”. We can use ‘text’, ‘content description’ and other
attribute to write xpath.