Hi Pallavi,
Please follow his (@Appium_Master) guidelines...
Two Different appium driver with different devicename and platform version executes test on same device
Platform i am using is MAC and Android Debug Bridge version 1.0.32 Revision eac51f2bb6a8-android
I am starting two appium servers
server 1 using port 4723 , chrome driver port is 62362
server 2 port is 4743 , chrome driver port is 62366
and i am setting in my desirered capablities
driver1:
url = new URL("http://" 127.0.0.1:4723/wd/hub");
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "LGD8553b0c00b3");
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"5.0");
driver2:
url = new URL("http://"0.0.0.0:4743/wd/hub");
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "0123456789ABCDEF");
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"4.4.2");
i am trying to launch driver1 and driver2 in one test to verify both devices screen have same values but when i am running test 1-> driver1 is run on LG and appium server 4723 and after that when the turn for driver2 comes the test again runs on LG only with appium server 4743. even though both have different device name and platform version in desiredcapablities.
when i execute adb devices it shows both devices are connected but when i am executing it from appium, whichever device is listed first both tests are executed on it. does the devicesName parameter does not affect the execution ?
here is the log of driver2 appium server
info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
info: Appium REST http interface listener started on 0.0.0.0:4743
info: [debug] Non-default server args: {"port":4743,"sessionOverride":true,"chromeDriverPort":62366,"defaultCommandTimeout":6000,"tmpDir":"/tmp/driver4743/"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.abcd","appActivity":"ui.activity.homescreens.SplashScreenActivity","platformVersion":"4.4.2","appWaitActivity":"ui.activity.homescreens.SplashScreenActivity,.ui.activity.homescreens.StartActivity,.ui.activity.RegisterFragments,.ui.activity.VideoActivity,.ui.activity.preferencesflow.PreferencesActivity,com.abcd/.ui.activity.homescreens.LargeProfilePhotoActivity,.ui.activity.DialpadActivity,.ui.activity.MoreActivity","browserName":"android","platformName":"Android","version":"","deviceName":"0123456789ABCDEF","platform":"ANDROID"}}
info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version, platform
info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session 01a341cc-7a51-4b54-b247-a402ba6ef64e
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_05
info: [debug] Checking whether adb is present
info: [debug] Using adb from /users/abcd/Library/Android/sdk/platform-tools/adb
warn: No app capability, can't parse package/activity
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it's already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb devices
info: [debug] 2 device(s) connected
info: Found device LGD8553b0c00b3
info: [debug] Setting device id to LGD8553b0c00b3
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 wait-for-device
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 21
info: Device API level is: 21
info: [debug] Extracting strings for language: default
info: [debug] Apk doesn't exist locally
info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "rm -rf /data/local/tmp/strings.json"
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an app path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 push "/usr/local/lib/node_modules/appium/build/android_bootstrap/AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 install "/usr/local/lib/node_modules/appium/build/settings_apk/settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 install "/usr/local/lib/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "ps 'uiautomator'"
info: [debug] Attempting to kill process 31990
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "kill 31990"
info: [debug] Running bootstrap
info: [debug] spawning: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.abcd -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
info: [debug] Getting device API level
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 21
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.abcd/ui.activity.homescreens.SplashScreenActivity"
info: [debug] We tried to start an activity that doesn't exist, retrying with . prepended to activity
info: [debug] Getting device API level
info: [debug] executing cmd: /users/abcd/Library/Android/sdk/platform-tools/adb -s LGD8553b0c00b3 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 21
@salmanchauhan
You need to provide the device UDID capability in order to tell the adb to select the correct device to run the test on.
Thanks alot man you saved my day @Hassan_Radi
Hi @salmanchauhan,
you must use MobileCapabilityType.UDID to select the device, instead of MobileCapabilityType.DEVICE_NAME.
deviceName server capability is only used on iOS simulator as you can see in http://appium.io/slate/en/master/?ruby#appium-server-capabilities64.
Hello Everyone,
i have a issue registering node using appium
my json file is
{
"capabilities":[
{
"deviceName":"a01b27a8",
"version":"5.1.1",
"maxInstances":5,
"platform":"ANDROID"
}
],
"Configuration":{
"cleanUpCycle":2000,
"timeout":30000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4723/wd/hub",
"hub":"http://192.168.1.202:4444/grid/register/",
"maxSession":1,
"Port":4723,
"host":"127.0.0.1",
"register":true,
"registerCycle":5000,
"hubHost":"192.168.1.202",
"hubport":"4444"
}
}
and the log what i got is
error: uncaughtException: Cannot read property 'url' of undefined date=Mon Dec 28 2015 16:33:22 GMT+0530 (India Standard Time), pid=2936, uid=null, gid=null, cwd=C:\Program Files\Appium\node_modules\appium, execPath=C:\Program Files\Appium\node.exe, version=v0.10.26, argv=[C:\Program Files\Appium\node.exe, C:\Program Files\Appium\node_modules\appium\lib\server\main.js, --address, 127.0.0.1, --port, 4725, --intent-category, android.intent.category.LAUNCHER, --nodeconfig, C:\Users\FC\workspace\XXXXXXt\Json\SamsungS4.json, --platform-name, Android, --platform-version, 22, --automation-name, Appium, --log-no-color], rss=71778304, heapTotal=61430984, heapUsed=42524552, loadavg=[0, 0, 0], uptime=17153.8082866, trace=[column=32, file=Files\Appium\node_modules\appium\lib\server\grid-register.js, function=postRequest (C:\Program, line=46, method=null, native=false, column=7, file=Files\Appium\node_modules\appium\lib\server\grid-register.js, function=C:\Program, line=14, method=null, native=false, column=14, file=fs.js, function=null, line=266, method=null, native=false, column=15, file=fs.js, function=Object.oncomplete, line=107, method=oncomplete, native=false], stack=[TypeError: Cannot read property 'url' of undefined, at postRequest (C:\Program Files\Appium\node_modules\appium\lib\server\grid-register.js:46:32), at C:\Program Files\Appium\node_modules\appium\lib\server\grid-register.js:14:7, at fs.js:266:14, at Object.oncomplete (fs.js:107:15)]
and to register node i used
appium -a 127.0.0.1 -p 4723 --bootstrap-port 4727 -U a01b27a8 --nodeconfig c:\Users\FC\workspace\XXXXXXt\Json\SamsungS4.json
Please help
Thank you
Ravi
@bhaskar
when I run my test I always see in my grid/consols that I have 1 Instance less (like not available).
How to manage it so after executing a test the Instance went back to be available, please?
@jonahss Will parallel tests be part of 1.5 ? Just asking because your post is from June 2015...Thanks
@jonahss I see. Until then, what do you think is the best way to run tests in parallel on iOS devices ? This Instruments limitation of 1 device per machine is still a thing, right ? So VM's would be a legit approach still ? Thanks !
Hi @Shankeyisgem.
In order to setup Selenium grid for Appium tests you need to have Selenium Hub running and 2 nodes,1 with Android capabilities and another with IOS capabilities registered with the hub.
Now if you are having your testsuite specified in TestNG.xml then you can specify parameter say e.g. "IOSTest" for a test which you want to give to IOS device to run and you can specify parameter e.g."AndroidTest" for a test which you want to give to Android device to run.
These settings "IOSTest" and "AndroidTest" based on which test distribution is going to happen,should be present in BrowserName capability included in .jason file which you may be using to start and register nodes.
And at script side you will be receiving these TestNG parameters and using it to set BrowserName DesiredCapability while instantiating DesiredCapabilities object which you will eventually use to create Driver object.
Note that to distribute tests among the registered nodes,"BrowserName" is the capability which Selenium Grid takes into consideration.
Hope this will help you out.If you want any other details then please feel free to contact me.
Thanks and Regards,
Pranoday
Thanks for your reply Pranodayd,
Couple of things:
I could set up selenium grid by issuing command in cmd but for registering Hubs which port numbers I should provide? Or can we have this Hub/node configuration specified in Eclispe for batter handling?
Actually I have very minimally used Appium with eclipse. So only simple script that I have is just to launch mobile app and some tapping arround and this script is just definded in a class file under eclipse project and when I running it as Tesng, it's going fine for my configured android device and I want to run this script in multiple devices.
Now that said, I have no Idea as how to configure Testing.XML/Json file in eclipse as you mentioned.
Can you send across some working code for same so that it is more clea for me?
No need to use Eclipse to configure and trigger Selenium Grid execution.You can configure TestNG.xml and .json files using any editor like Notepad etc.
following is and example .json file:
{
"capabilities":
[
{
"browserName": "IpadMiniDevice",
"version":"8.5",
"maxInstances": 1,
"platform":"MAC",
"deviceName":"IpadMiniDevice"
},
{
"browserName": "AllIpadDevices",
"version":"8.5",
"maxInstances": 1,
"platform":"MAC",
"deviceName":"AllTabletDevices"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":0,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://<IpAddress on Which AppiumServer is running:Port on Which AppiumServer is running>/wd/hub",
"maxSession": 1,
"port": <Port on Which AppiumServer is running>,
"host": <IpAddress on Which AppiumServer is running>,
"register": true,
"registerCycle": 5000,
"hubPort": <Port on Which Selenium Grid hub is running>,
"hubHost": <IpAddress on Which Selenium Grid hub is running>
}
}
You can start Selenium Grid hub and nodes using following dos commands:
To start Hub use following command:
java -jar -timeout 0 -remoteControlPollingIntervalInSeconds 300 -role hub
To start and register node use following command:
java -jar -role node -nodeConfig
Thanks and Regards,
Pranoday
Hi Bhaskar,
Could you please help me know how you did with single driver instance?? Currently i am able to do that by creating multiple capabilities object and passing them on multiple driver instances. This is not the correct approach i know. Please help me how did you define in your class file and xml. Please.
if possible could you share your code snippet??
Hi Bhashkar,
Can u please send me the document if any to start Appium Grid with Mac for One Machine with Multiple Devices.
Please do the needful Send me the Document if possible to janardhanreddyqa@gmail.com1
Thanks & Regards,
Janardhan Reddy M.
my selenium grid is running but when i try to run node server by "node appium --nodeconfig /Users/RajShekhar_DiroLabs/Desktop/node1.json -p 4730 -bp 4730"
its shows me logs like
Appium] Welcome to Appium v1.5.2
[Appium] Non-default server args:
[Appium] port: 4730
[Appium] bootstrapPort: 4730
[Appium] nodeconfig: '/Users/RajShekhar_DiroLabs/Desktop/node1.json'
[Appium] Unable to load node configuration file to register with grid: ENOENT: no such file or directory, open '/Users/RajShekhar_DiroLabs/Desktop/node1.json'
[Appium] Appium REST http interface listener started on 0.0.0.0:4730
but shows Unable to load node configuration file to register with grid: ENOENT: no such file or directory, open '/Users/RajShekhar_DiroLabs/Desktop/node1.json'
Can any one please suggest me how to load node with selenium grid
json file
{
"capabilities":
[ {
"browserName":
"Android", "version":"5.0.1",
"maxInstances": 3,
"platform":"ANDROID",
"deviceName":"FCAZGU007688H3D" } ],
"configuration":
{
"nodeTimeout":120, "port":4730, "hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4730/wd/hub",
"hub": "127.0.0.1:4444/grid/register",
"hubHost":"127.0.0.1",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000,
"maxSession":1
} }
@saikrishna321 Is it possible parallel execution in iOS devices?
@sanoj27 yeah you can run parallel tests on iOS real devices ..
hello,
During start node server it shows a error "Syntax error in node configuration file: Unexpected token P"
srikantas-Mac-mini-3:bin RajShekhar_DiroLabs$ appium --nodeconfig /Users/RajShekhar_DiroLabs/Desktop/node1.json -p 4730
[Appium] Welcome to Appium v1.5.2
[Appium] Non-default server args:
[Appium] port: 4730
[Appium] nodeconfig: '/Users/RajShekhar_DiroLabs/Desktop/node1.json'
[Appium] Error: Syntax error in node configuration file: Unexpected token P
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at postRequest$ (lib/grid-register.js:42:12)
Can any one please suggest me how to resolve it
I am able to run appium tests on two different devices but they run one after the other. I want them to run on both the devices simultaneously(parallel). I am running appium on two different ports.This is how I am doing it.
appium -p 4725 -bp 4735 -U "706b9496" --chromedriver-port 9518
appium -p 4735 -bp 4745 -U "ZX1B34JFZK" --chromedriver-port 9528
Can anyone help me how to do it?
Hello,
Can any one please help me ,
My nodes are working on hub but when i run my script it shows on hub
13:16:06.657 INFO - Available nodes: [http://0.0.0.0:4725]
13:16:06.657 INFO - Trying to create a new session on node http://0.0.0.0:4725
13:16:06.657 INFO - Trying to create a new session on test slot {maxInstance=1, browserName=Android, version=5.0 .2 , platform=ANDROID}
but in node shows error missing plateformName and shows version name blank i can not recognize that node picking desired capabilities from where
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"browserName":"android","version":"","platform":"ANDROID"}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"browserName":"android","version":"","platform":"ANDROID"},null,null,null,null,null,null,null,null,null,null,null,null,null]
[MJSONWP] Encountered internal error running command: Error: You must include a platformName capability
at AppiumDriver.getDriverForCaps (lib/appium.js:40:13)
at AppiumDriver.createSession$ (lib/appium.js:91:28)
With 1.5 new features says, you can start multiple sessions in 1 server. Or did i understand badly?
At the moment I'm using 2 emulators in paralel with selenium grid. It works fine but I have to open a new appium server for all emulators I need. So if I want to run with 20 different device emulators, I need to launch 20 appium server, which is not cool. My configuration is like this;
appium -a 172.20.0.196 -p 4723 --session-override --nodeconfig appiumnodeconfig1.json
appium -a 172.20.0.196 -p 4724 --session-override --nodeconfig appiumnodeconfig2.json
appiumnodeconfig1.json:
{
"capabilities": [
{
"browserName": "android",
"version": "5.1",
"platform": "ANDROID",
"maxInstances": 1,
"deviceName": "192.168.56.101:5555"
}
],
"configuration": {
"nodeTimeout" : 120,
"port": 4723,
"hubPort": 4444,
"url": "http://172.20.0.196:4723/wd/hub",
"hub": "172.20.0.196:4444/grid/register",
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"hubHost": "172.20.0.196",
"nodePolling": 2000,
"registerCycle": 10000,
"register": true,
"cleanUpCycle": 2000,
"timeout": 30000,
"maxSession": 1
}
}
appiumnodeconfig2.json:
{
"capabilities": [
{
"browserName": "android",
"version": "5.1",
"platform": "ANDROID",
"maxInstances": 1,
"deviceName": "192.168.56.102:5555"
}
],
"configuration": {
"nodeTimeout" : 120,
"port": 4724,
"hubPort": 4444,
"url": "http://172.20.0.196:4724/wd/hub",
"hub": "172.20.0.196:4444/grid/register",
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"hubHost": "172.20.0.196",
"nodePolling": 2000,
"registerCycle": 10000,
"register": true,
"cleanUpCycle": 2000,
"timeout": 30000,
"maxSession": 1
}
}
The thing is, I want to start only 1 appium server and connect multiple emulators to it. Can I do it and how?
Thanks in advance
Check here www.appiumforbeginners.com89 for Appium Grid concept
Thank you but it doesn't answer my question. Tutorials on the website shows exactly the same configuration with mine. You have to open a server for every node.
But I already got the answer from Jonathan Lipps yesterday. He told me that 1.5 work was the groundwork for that new feature, but the feature itself is not released. I guess we're going to have to wait unfortunately.
Hi @pushpank
Can you please share the steps to run appium script parallel without using selenium grid infrastructure.
Thanks
Ravi Kumar
Hi @bhaskar,
After doing everything as I found in the discussions, I was able to launch android app in multiple devices in parallel. But after that, only one device was able to finish the rest of the automation, other devices got stuck right after launching app.
P.S.: I was able to launch apps using session overriding, otherwise I was not able to launch apps in parallel even though different servers were running.
Thanks,
Minar
Hi @ravikr42
Sorry for late reply , pls share your email id .