Appium: UiAutomator exited unexpectedly with code 0, signal null - java

Appium version : 1.6.4-beta
Appium server throws following exception:
Caused by: org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 22 milliseconds
os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_121'
Driver info: io.appium.java_client.android.AndroidDriver
I see following in appium server log:
UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [AndroidDriver] Shutting down Android driver
[Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
[Appium] Removing session 1865dd4e-ed7e-431a-8233-0227173400a5 from our master session list
I dont understand why UiAutomator is exiting. Any help here is much appreciated.

This error looks like occurs just when the process com.android.commands.monkey is running. After I kill it the appium runs the test normally.
To kill it just run:
adb shell ps | grep com.android.commands.monkey | awk '{print $2}' | xargs adb shell kill -9

I also see the same issue
UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
[debug] [UiAutomator] Moving to state 'stopped'
But the reason was my device was disconnected, when I connect again its work fine.
Basically UiAutomator is looking for device and app screen, it if it is not display than it shows error in Appium server console.

Related

Appium Desktop can't find connected physical device in time

I'm generally a tech noob and this is my first post here, so feel free to bash me for everything wrong about my post, so I better myself^^
I'm googling and searching stack overflow a while know for this issue, but most of the related topics revolve around simulators or have clearly different causes.
I'm running tests on Android and iOS Devices using Jenkins on a Mac mini with Appium Desktop. In the beginning of the Android tests I need to reboot the devices. I do so via adb reboot and unlock the devices via adb too. This all works fine and results in an unlocked Android device with active screen.
My Issue is, that when there are multiple physical devices connected to the Mac mini, I seemingly random run into the error, that Appium won't find the device I'm targeting via the udid, even though adb already unlocked the phone, so there definitely is a physical connection.
The devices also all show up when i run adb devices.
I can solve the issue by disconnecting some of the devices that are not the target of the current job.
I want to use two iOS and two Android-devices in total. Sometimes it works, but only until it doesn't.
It happens on different Macs too, but I don't know if this maybe even is a physical thing with the Macs, since I don't have the possibility to test it on Windows machines.
Here is the part of my Appium logs:
[info] [35m[AndroidDriver][39m Retrieving device list
[debug] [35m[ADB][39m Trying to find a connected android device
[debug] [35m[ADB][39m Getting connected devices
[debug] [35m[ADB][39m Connected devices: [{"udid":"97RAY11PXB","state":"device"}]
[error] [35m[AndroidDriver][39m Device 03JAYV27BX was not in the list of connected devices
Here is some of my jenkins console output:
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Device 03JAYV27BX was not in the list of connected devices Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'Users-Mac-mini.local', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '13.0.2' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Device 03JAYV27BX was not in the list of connected devices at getResponseForW3CError (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/protocol/errors.js:804:9) at asyncHandler (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'Users-Mac-mini.local', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '13.0.2' Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131) at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:88) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:98) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:94) at

Getting A new session could not be created

Can anyone help me out I am new to Android testing with Appium , I am trying to open app in AVD the app getting installed but then m getting Error "A new Session could not be created.(Original error: Command failed: )","killed":false,"code":1,"signal":null,"origValue":"Command failed: "},"sessionId":null}
Thanks for the help in advance
tried with just giving capabilities.setCapability("appActivity", ".MainActivity");
'''
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "/Apps/src/");
File app = new File(appDir, "ChatApp-release.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "emulator-5554");
capabilities.setCapability("platformVersion", "7.1.1");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.aaa.charla");
capabilities.setCapability("appActivity", "com.aaa.xxx.MainActivity");
driver = new AndroidDriver(new URL("https://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Thread.sleep(10000);
driver.quit();
Following are the Debug log:
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk","appPackage":"com.odysseyinc.charla","appActivity":"com.odyssey.chatapp.MainActivity","newCommandTimeout":"10000","platformName":"Android","version":"7.1.1","deviceName":"emulator-5554"}}
info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_162)
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
info: [debug] Using local app from desired caps: D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk
info: [debug] Creating new appium session 0d25aeac-d055-449f-af84-b6d314d9b4a5
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_162
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe
info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 25
info: Device API level is: 25
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language:
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk" "C:\Users\UNMESH~1.GHA\AppData\Local\Temp\com.odysseyinc.charla"
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Users\UNMESH~1.GHA\AppData\Local\Temp\com.odysseyinc.charla\strings.json" /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt.exe dump xmltree D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk AndroidManifest.xml
info: [debug] Set app process to: com.odysseyinc.charla
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk
info: [debug] App already signed.
info: [debug] Zip-aligning D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe -f 4 D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk C:\Users\UNMESH~1.GHA\AppData\Local\Temp\119427-15556-1rmbgw9\appium.tmp
info: [debug] MD5 for app is f3d7efc8b197792c3d0529a48dc92ff2
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "ls /data/local/tmp/f3d7efc8b197792c3d0529a48dc92ff2.apk"
info: [debug] Getting install status for com.odysseyinc.charla
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 25
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "pm list packages -3 com.odysseyinc.charla"
info: [debug] App is installed
info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "am force-stop com.odysseyinc.charla"
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "pm clear com.odysseyinc.charla"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
error: Failed to start an Appium session, err was: Error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]
at ChildProcess.exithandler (child_process.js:637:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\r\n)","killed":false,"code":1,"signal":null,"origValue":"Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\r\n"},"sessionId":null}
info: <-- POST /wd/hub/session 500 32039.992 ms - 664
`
You need to share the full appium logs in order to know the reason for that.
[After checking the logs]
That's a known issue for that specific Android image as it installs 2 versions of appium settings app and unlock app. What you can do is either change the android image you are testing against or uninstall those 2 apps before starting your script.
You can uninstall them manually by starting the emulator GUI and do that with the mouse or through the below commands:
adb -s device_serial uninstall io.appium.settings
adb -s device_serial uninstall io.appium.unlock
Also, you can add those commands in your code if you really have to execute the tests on android 7 devices as below:
String androidVersion=executeCommand("adb shell getprop ro.build.version.release");
if(androidVersion.contains("7"))
{
//uninstall appium settings app
cmd="adb uninstall io.appium.settings";
executeCommand(cmd);
//uninstall appium unlock app
cmd="adb uninstall io.appium.unlock";
executeCommand(cmd);
}
I have upgraded the Appuim 1.4 to 1.9 and started working as Expected .

Appium session, could not find a connected Android device. Shows error

Appium session, could not find a connected Android device. Shows error in eclipse
If any one know how to fix please let me know.
**The Junit code: - **
import static org.junit.Assert.*;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class desiredCapab {
#Test
public void test() throws MalformedURLException {
File appDir = new File("C:\\Eclipse-Neon\\Project\\AppiumT\\Apk\\");
File app = new File (appDir, "WhatsApp.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver = new AndroidDriver(new URL ("http://127.0.0.1:4723/wd/hub"), cap);
//{"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
}
}
Eclipse Junit Error :-
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find a connected Android device.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 28.61 seconds
Build info: version: '2.49.0', revision: '365eeb4', time: '2016-01-13 18:33:29'
System info: host: 'DESKTOP-PC1SJR4', ip: '192.168.1.104', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
AVD manager setting: - Image
Appium :- Error message
> info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"C:\\Eclipse-Neon\\Project\\AppiumT\\Apk\\WhatsApp.apk","platformName":"Android","deviceName":"Android Emulator"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_91)
> info: [debug] No appActivity desired capability or server param. Parsing from apk.
> info: [debug] No appPackage desired capability or server param. Parsing from apk.
> info: [debug] Using local app from desired caps: C:\Eclipse-Neon\Project\AppiumT\Apk\WhatsApp.apk
> info: [debug] Creating new appium session c9232f90-f519-4058-9e80-22cd2830de57
> info: Starting android appium
> info: [debug] Getting Java version
> info: Java version is: 1.8.0_101
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe
> info: [debug] Parsing package and activity from app manifest
> info: [debug] Checking whether aapt is present
> info: [debug] Using aapt from C:\Users\bizBoxChat\AppData\Local\Android\sdk\build-tools\24.0.3\aapt.exe
> info: [debug] Extracting package and launch activity from manifest.
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\build-tools\24.0.3\aapt.exe dump badging C:\Eclipse-Neon\Project\AppiumT\Apk\WhatsApp.apk
> info: [debug] badging package: com.whatsapp
> info: [debug] badging act: com.whatsapp.Main
> info: [debug] Parsed package and activity are: com.whatsapp/com.whatsapp.Main
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Checking whether app is actually present
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 0 device(s) connected
> info: [debug] Could not find devices, restarting adb server...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 0 device(s) connected
> info: [debug] Could not find devices, restarting adb server...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 0 device(s) connected
> info: [debug] Could not find devices, restarting adb server...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 0 device(s) connected
> info: [debug] Could not find devices, restarting adb server...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 0 device(s) connected
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> warn: UiAutomator did not shut down fast enough, calling it gone
> info: [debug] Cleaning up android objects
> info: [debug] Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: Could not find a connected Android device.
> info: [debug] Error: Could not find a connected Android device.
> at [object Object].ADB.getDevicesWithRetry (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:606:15)
> at [object Object].androidCommon.prepareActiveDevice (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:400:12)
> at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:326:26)
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17
> at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13)
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34
> at [object Object].androidCommon.ensureDeviceLocale (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:371:45)
> at [object Object].androidCommon.prepareEmulator (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:364:10)
> at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:325:26)
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17
> at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13)
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21
> at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34
> at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:344:9)
> at FSReqWrap.oncomplete (fs.js:95:15)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}
> info: <-- POST /wd/hub/session 500 28492.200 ms - 206
Reason of above error is, any device or AVD could not be found to be connected. Following lines in your error message show this:
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 0 device(s) connected
> info: [debug] Could not find devices, restarting adb server...
> info: [debug] Error: Could not find a connected Android device.
Just creating AVD in AVD manager is not sufficient. It has to be up and running (started and ready). To do that, select any AVD in your AVD manager, and click on "Start" button. Let the AVD boot. Wait. (It is similar to a real device switching on.)
Or, some real device needs to be connected. In that device, "Developer Options" should be On. "USB debugging" should be On.
Go to command prompt and run following command:
adb devices
Expected output: Some device or AVD should be shown as connected.
Once you see any device or AVD connected, and retry, then your problem will be solved.
Note:
On running "adb devices" command in command window, if you see message like "abd.exe is an unrecognized internal or external command or batch file...", then you need to have adb.exe in path. You can add its path in environment variables, or simply run following command before running "adb devices":
set path=%PATH%;"D:\AndroidSDK\platform-tools"
Note that adb.exe file is in platform-tools folder on my PC, in Android SDK folder. You will need to modify this path as it is on your PC.
Try to use real device, since emulators are very slow and booting time will also take more time. Even real device also I was facing this kind of issue,
Expecting causes :
Android emulator startup issue
ADB issue
System config
If adb issue, you need run following command in your cmd:
adb kill-server
adb start-server
Then you try with Android emulator and make ensure you system has enough memory these emulator like VM this will CPU & memory of your system accountable amount.

Firefox Webdriver Selenium "No protocol specified" , Debian(Wheezy) , Service , Script

i have got a problem with my executable jar on my cubietruck running on cubian.
I want to start the jar when the cubietruck starts. The Jar itselfs uses selenium-server-standalone-2.43.1.jar to control firefox.
For starting my jar i created a simple bash script ('/usr/local/bin/startplt.sh')
#!/bin/bash
PATH=/bin:/sbin:
JAVA=/usr/bin/java
JARFILE=/home/cubie/plt/plt.jar
USER=cubie
/bin/su -$USER -c "$JAVA -jar $JARFILE"
Executing this script in Console works and opens firefox successful.
For getting my jar to start at startup i created a service ('/etc/init.d/startjar')
#! /bin/sh
### BEGIN INIT INFO
# Provides: startjar
# Required-Start: $all
# Required-Stop: $remote_fs $syslog $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts plt.jar
# Description: starts a the main jarfile
### END INIT INFO
NAME="startjar"
DESC="Starts /home/cubie/plt/plt.jar"
case "$1" in
start)
export DISPLAY=:0.0
sudo /usr/local/bin/startplt.sh
;;
stop)
pkill -f /home/cubie/plt/plt.jar
pkill -f iceweasel
;;
*)
exit 1
;;
esac
exit 0
And inserted it to system by:
insserv /etc/init.d/startjar
The service gets executed at startup but it doesnt start firefox.
Instead its writing in the logfile :
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 056 after 45000 ms. Firefox console output:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at de.etc.plt.display.DisplayManager.<init>(DisplayManager.java:20)
at de.etc.plt.display.DisplayManager.getInstance(DisplayManager.java:26)
at de.etc.plt.service.impl.DisplayService.<init>(DisplayService.java:25)
at de.etc.plt.MainThread.run(MainThread.java:33)
at java.lang.Thread.run(Thread.java:745)
2014-10-09 12:25:27 [ERROR]:Firefox konnte nicht gestartet werden
2014-10-09 12:25:27 [org.openqa.selenium.WebDriverException]:Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7056; process output follows:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'Cubian', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '3.4.79-sun7i', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7056; process output follows:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'Cubian', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '3.4.79-sun7i', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at de.etc.plt.display.DisplayManager.<init>(DisplayManager.java:20)
at de.etc.plt.display.DisplayManager.getInstance(DisplayManager.java:26)
at de.etc.plt.service.impl.DisplayService.<init>(DisplayService.java:25)
at de.etc.plt.MainThread.run(MainThread.java:33)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7056 after 45000 ms. Firefox console output:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
... 11 more
I really dont understand why the simple script startplt.sh is working even without the extra added line export DISPLAY=:0.0 to get rid of the error "no display specified"
Maybe the service is starting before even the xserver started? I dont know how to find that out. Some Help would be really appreciated.
If you have another working solution for executing scripts after boot on cubian i would be happy too.
EDIT: I got firefox working via enabling multiple users to use the xserver with xhost + and then service startjar start. But still have the problem that it isnt working on start of the system
I fixed my issue by changing the startplt.sh to
#!/bin/bash
PATH=/bin:/sbin:
JAVA=/usr/bin/java
JARFILE=/home/cubie/plt/plt.jar
USER=cubie
DISPLAY=:0
export DISPLAY
xhost +
/bin/su -$USER -c "$JAVA -jar $JARFILE"
and removed that one line from the startjar service.
the xhost + was needed to allow m< jar to use my xserver for setting up the firefox

Appium: How do you run Java tests and devices on local machine against a remote appium server

Is it possible to have Appium running on a remote machine, while having a device connected to a local machine, and also run the tests from the local machine?
Currently, Appium continues to check adb for devices where Appium is running (which of course there is none) and fails after timing out. I have zero problems running Appium locally.
Here are my Capabilities running from the Local machine where the device is connected ( IP: 192.168.1.78 ) :
#Before
public void setUp() throws Exception
{
final DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("appium-version", "1.2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("deviceName", "SCH-I545");
capabilities.setCapability("appPackage", "<appPackage_goes_here>");
capabilities.setCapability("appActivity", "<appActivity_goes_here>");
driver = new AppiumDriver(new URL("http://192.168.2.109:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
And here is the Appium Console Log from the Remote machine ( IP: 192.168.2.109 ):
QA1#QA1s-Mac-mini:3.2: ~/appium :$node .
info: Welcome to Appium v1.2.0 (REV 83e64a139b928fb1f6c06e50370f9f0140ecaa30)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4","platformName":"Android","deviceName":"SCH-I545","browserName":"","appActivity":"com.alldigital.android.cox.NewsActivity","appium-version":"1.2","appPackage":"com.cmgdigital.wsoctvhandset"}}
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. : appium-version
debug: Didn't get app but did get Android package, will attempt to launch it on the device
debug: Creating new appium session b184a564-321d-4753-af63-9bd7fbf56b6e
info: Starting android appium
debug: Using fast reset? true
debug: Preparing device for session
debug: Not checking whether app is present since we are assuming it's already on the device
debug: Checking whether adb is present
debug: Using adb from /Users/QA1/android-sdk-macosx/sdk/platform-tools/adb
info: Retrieving device
debug: Trying to find a connected android device
debug: Getting connected devices...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" devices
debug: 0 device(s) connected
debug: Could not find devices, restarting adb server...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" kill-server
debug: Getting connected devices...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" devices
debug: 0 device(s) connected
....... continues trying .......
debug: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
debug: Cleaning up android objects
debug: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not find a connected Android device.
debug: Error: Could not find a connected Android device.
at ADB.getDevicesWithRetry (/Users/QA1/appium/node_modules/appium-adb/lib/adb.js:612:15)
at androidCommon.prepareActiveDevice (/Users/QA1/appium/lib/devices/android/android-common.js:354:12)
at null.<anonymous> (/Users/QA1/appium/lib/devices/android/android-common.js:294:26)
at /Users/QA1/appium/node_modules/async/lib/async.js:610:21
at /Users/QA1/appium/node_modules/async/lib/async.js:249:17
at iterate (/Users/QA1/appium/node_modules/async/lib/async.js:149:13)
at /Users/QA1/appium/node_modules/async/lib/async.js:160:25
at /Users/QA1/appium/node_modules/async/lib/async.js:251:21
at /Users/QA1/appium/node_modules/async/lib/async.js:615:34
at androidCommon.prepareEmulator (/Users/QA1/appium/lib/devices/android/android-common.js:344:5)
debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}
info: <-- POST /wd/hub/session 500 30473.764 ms - 206
Try to use:
driver = new RemoteWebDriver(new URL("http://192.168.2.109:4723/wd/hub"), capabilities);

Categories

Resources