Appium : How to start Appium server using command line

How to start Appium server using command line 


This is very common scenario where you will be needed to trigger/start Appium server either using command line or trigger through .bat file in automation.
I will explain here step by step how to do this and creating a .bat file in the end.

*** You can download batch file from here “appiumserver”(see explanation below)

To do this, please follow the below steps:

 Step 1: Make sure you have Node installed (if not, download it fromlink )  and would be good if
              you configured in your path variable, such that you can run node  from anywhere in your pc
              .It will be helpful in your automation.

Type node in command prompt, you will see like below screenshot (if it configured properly)
C :\> node        


 Step 2: Make sure you have Appium server is installed.

 Step 3: Open Command Prompt and navigate to Appium folder till below path(based on your
              machine ,path may change)
C:\Program Files (x86)\Appium\node_modules



 Step 4: Now run below command, with Appium server argument which you think to be part of it, I
              have passed minimum argument, based on your requirement you can add more.

 -> node appium --address 127.0.0.1 --port 4725 --platform-name Android --platform-version 19 --automation-name Appium



You can see Appium started at port 4725 , 



You can also verify one step ahead by hitting the below URL in your browser
http://127.0.0.1:4725/wd/hub/status 




Step 5:  Creating a batch file, this will make your life little easier in setup and running Appium script.
              Open notepad and paste below code and save it as "appiumserver.bat"
REM ############################################################################ 
REM ## START

echo "navigating to Appium folder"
REM ## change the folder path , based on your machine
cd /D C:/Appium/Appium/node_modules
node appium --address 127.0.0.1 --port 4725 --platform-name Android --platform-version 19 --automation-name Appium

REM ##END
REM############################################################################

You can download it from here “appiumserver

Comment down below for any questions.



Automation : How to map network drive and save file to a shared location using AutoIT and Powershell.


 This is a sample script which lets you map your network share to your windows 
 machine/system. 
 This can be used/helpful in your scripting where you want to save your results 
 in a shared folder once you are done with test execution.

 - Tools used here is AutoIT , which helps in triggering powershell commands on 
   windows machine and opens notepad and save it to network share.
 - Benefit of using AutoIT is that you can create .exe file and can be run/trigger 
   from remote using .bat file etc. 

;#----------------------------------------------------------------------------  
;## Script Function:
;## To map network drive and open Notepad and save file to a shared location.

;##@author : P programs
;##----------------------------------------------------------------------------

Run("powershell.exe")
Sleep(1000)

;send("net use : \\\shared_folder_name  /User:")
send("net use o: \\10.20.30.40\results secretPassword /User:userdemo1")

Send("{ENTER}")
Send("exit")
Send("{ENTER}")
;WinClose("powershell.exe")
sleep(1000)
Run("notepad.exe")
$handle = WinWaitActive("[CLASS:Notepad]","")
WinSetState("[CLASS:Notepad]","",@SW_MAXIMIZE)
sleep(160000)
Send("Hello there")
WinClose($handle)
$handle = WinGetHandle("[ACTIVE]")
ControlClick($handle,"","[CLASS:Button; INSTANCE:1]")
$handle = WinWaitActive("[CLASS:#32770]","")
$hw = WinGetHandle("[ACTIVE]")
ControlSetText($hw, "", "ComboBox1", "O:\results")
ControlSend($hw,"","ComboBox3","UTF-8")
;sleep(2000)
ControlClick($hw,"","[CLASS:Button; INSTANCE:1]") ;to click on the button



Reference links: http://ss64.com/nt/net_share.html
                 http://ss64.com/nt/net_use.html



Appium : How to get the activity name of android application

How to get the activity name of android application


For mobile app automation, Appium requires app activity name (usually the first screen of your app when you tap on app to launch it ) in desired capabilities parameter . To get the app activity name which Appium can use while launching an app. here are the ways you can use to get the same  

Step 1 : using the aapt command.

To get the aapt.exe , you have to navigate to android sdk folder then build-tools and goto some api version . for example(specific to my machine) 
E:\Android\adt\sdk\build-tools\android-4.4W 

open command prompt and run the below command 
aapt dump badging

for example : Let's take whatsapp application
aapt dump badging E:\com.whatsapp.apk

output :
You can get the package name and launchable-activity with other details as highlighted in below :





























Step 2: using Appium UI console


Android : How to connect your Android device over Wifi using ADB command for App debugging

How to connect your Android device over Wi-Fi using ADB command Sometimes it requires to connect your Android dev...