How to create two appium instances?

Hi,

I just started working on appium with python, i want to run same script on two android devices at a same time on same machine. For example: I want to Call from device 1 and accepting the call on device 2.

My question is: How to start 2 appium clients and configure it to 2 different android devices. I have gone through few posts previously posted but not able to figure it out. pls help.

@willosser - Sorry to tag, but I think you are the right person to answer this post.

just start appium with certain port e.g.:

start appium as: [appium, --log-level, error, --port, 4725, --bootstrap-port, 5725, --command-timeout, 90, --session-override]

start appium as: [appium, --log-level, error, --port, 4735, --bootstrap-port, 5735, --command-timeout, 90, --session-override]

now you can open 2 drivers one for first instance another one for second one. e.g. for first:
url is:

AndroidDriver: http://0.0.0.0:4725/wd/hub (0.0.0.0 is just mine specific. in your case needed ip)

Hi, Thanks for post.

appium, --log-level, error, --port, 4725, --bootstrap-port, 5725, --command-timeout, 90, --session-override

i ran above command hoping appium will open with the given port number(4725) but appium is launched with default port(4723). do i have to change port manually whenappium is launched from settings option.

by the way i use ‘http://127.0.0.1:4725/wd/hub’ for web driver

remove all “,” - and should be ok. BTW how you start appium programmatically?

@Aleksei, you do that by putting together a command line like the above and fork/exec from your program.

Don’t you need to pass the device id to the appium server? My memory suggests the server will try to grab the first device available device otherwise.

@willosser no. i do it in driver. example of driver capabilities:
Capabilities [{app=/Users/Aleksei/Downloads/test_clients/xxxx.apk, noReset=false, clearSystemFiles=true, appWaitActivity=xxxxx, disableAndroidWatchers=true, version=, deviceName=LGH8155e9892e6, fullReset=true, platform=ANDROID, automationName=Appium, browserName=, autoGrantPermissions=true, waitForAppScript=$.delay(100); true;, udid=LGH8155e9892e6, platformName=Android}]

Still no luck, i removed all “,” and result was same as previous…must be doing some thing wrong. btw i start appium manually by clicking start button

you should start appium programmatically and in command line. see the forum - depending how you installed appium it is slightly changes in code.

Hi Can please help how to run appium programatically.

im able to to start the appium server from Command prompt

C:\Program Files (x86)\Appium\node_modules>node appium
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug

pls help me how to put same in python progam

i am with java. sorry.

Hi All,

	@DataProvider(parallel=true)
		public Object[][] portDriver()
		{
		//Rows - Number of times your test has to be repeated.
		//Columns - Number of parameters in test data.
		Object[][] data = new Object[2][1];

		// 1st row
		data[0][0] ="5d6ef2bd";
		// 2nd row
		data[1][0] ="d859dc2d";
		return data;
		}
	
		
		public static String firstDeviceName="5d6ef2bd";
		public static String SecondDeviceName="d859dc2d";


			
			@Factory(dataProvider="portDriver")
			@BeforeClass
			public void Init(String device_id) throws IOException, InterruptedException{
				DesiredCapabilities capabilities = new DesiredCapabilities();
				if(device_id.equalsIgnoreCase(firstDeviceName)){	
					capabilities.setCapability("deviceName",firstDeviceName);
					capabilities.setCapability("udid", firstDeviceName);
					capabilities.setCapability(MobileCapabilityType.APP,"/Users/shanthalakshmi/Documents/BushfireFinal/BushFire1/Resources/app/BushFire 1.0.0.4.apk");
					//setDeviceID=device_id;
					driver1=new AndroidDriver(new URL("http://127.0.0.1:4733/wd/hub"), capabilities);
			        driver1.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
			      
					
				}else if(device_id.equalsIgnoreCase(SecondDeviceName)){
					
					capabilities.setCapability("deviceName",SecondDeviceName);
					capabilities.setCapability("udid", SecondDeviceName);
					capabilities.setCapability(MobileCapabilityType.APP,"/Users/shanthalakshmi/Documents/BushfireFinal/BushFire1/Resources/app/BushFire 1.0.0.4.apk");
					driver2=new AndroidDriver(new URL("http://127.0.0.1:4743/wd/hub"), capabilities);
			        driver2.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);			      
					
				}
		}

only one session is getting invoked…Please help me

@slakshmiics @nagesh Were you able to run appium automation on 2 different instances? Do you require more than 1 driver for starting multiple instances?