Appium + native device error - appium

i am try to run first script of appium to check the set up installed properly, but facing exception please help.
FAILED CONFIGURATION: #BeforeTest setUp org.openqa.selenium.WebDriverException: ERROR running Appium command: ENOENT, no such file or directory 'C:\Program Files\Android\Android Studio\build-tools' Command duration or timeout: 171 milliseconds Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40' System info: host: 'LAPTOP-FHNL3FTF', ip: '192.168.1.180', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91' Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

Have you checked if you have the android build tools and if it is correctly added to your path, which is what the exception stack is complaining about?
It is looking for the build tools in your 'C:\Program Files\Android\Android Studio\build-tools', check path env variable, and also check if that env variable that points to the build tools folder corresponding to the api level number (e.g. 'C:\Program Files\Android\Android Studio\build-tools\22.0'.

Related

chrome failed to start: exited abnormally in docker container on macos

On my Mac, I built image with FROM selenium/standalone-chrome-debug:3.4.0-chromium in Dockerfile.
When I run my app in the container, I got:
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.19.76-linuxkit x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.13 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'a45e0250acbf', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
Image built in Jenkins with same Dockerfile run same application, it has no issue. Both chromedriver=2.29.461571.
I have setup remote debug and want to debug on my macos before I push to Jenkins/linux, but blocked by this chrome failed to start: exited abnormally in container on macos.
Why this happens on my macos but not in Jenkins/Linux and how to fix it?
This error message...
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.19.76-linuxkit x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.13 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'a45e0250acbf', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.29
Release Notes of chromedriver=2.29 clearly mentions the following :
Supports Chrome v56-58
Presumably you are using the latest chrome=85.0
Release Notes of ChromeDriver v85.0 clearly mentions the following :
Supports Chrome version 85
So there is a clear mismatch between ChromeDriver v2.40 and the Chrome Browser v85.0
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u252.
Selenium is upgraded to current released Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v85.0 level.
Chrome is updated to current Chrome Version 85.0 level. (as per ChromeDriver v85.0 release notes)
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Launching appium server programmatically throws server-side error Could not find 'adb' in PATH

While launch appium server manually this issue doesnt occur.
Error log
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: Could not find 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INSML-0VLLVCF', ip: 'fe80:0:0:0:c3f:fa48:d75f:bc45%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_251'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INSML-0VLLVCF', ip: 'fe80:0:0:0:c3f:fa48:d75f:bc45%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_251'
Driver info: driver.version: AndroidDriver
Run which aapt in terminal and check the output. Most likely it is empty.
If you didn't install adb, you can follow these steps
If you install it, then probably you didn't set path properly: run cat ~/.bash_profile and make sure to set path to ANDROID_HOME, assuming you did default path installation
export ANDROID_HOME=/Users/<your_username>/Library/Android/sdk
export PATH=$ANDROID_HOME:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/build-tools/<sdk_version>:$PATH
You can check official Appium docs about environment issues troubleshoot

Appium test script error: Could not find 'adb.exe'

Hi,
I am learning Appium and this is my first automation script for appium.
Getting below error while running simple program to open calculator application in Android device.
It says that could not find 'adb.exe' but its there in the SDK tools folder. Also I have set ANDROID_HOME in Environment variables and have PATH variable accordingly.Please help.
Exception in thread "main" 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: Could not find 'adb.exe' in ["C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\platform-tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\emulator\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\bin\adb.exe"]. Do you have Android Build Tools installed at 'C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest'?
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-TN4V3G6', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13.0.2'
Driver info: driver.version: AppiumDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find 'adb.exe' in ["C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\platform-tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\emulator\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\bin\adb.exe"]. Do you have Android Build Tools installed at 'C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest'?
at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
at asyncHandler (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-TN4V3G6', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13.0.2'
Driver info: driver.version: AppiumDriver
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 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.(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:98)
at AppTest1.openCalculator(AppTest1.java:36)
at AppTest1.main(AppTest1.java:16)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
... 13 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find 'adb.exe' in ["C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\platform-tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\emulator\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\bin\adb.exe"]. Do you have Android Build Tools installed at 'C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest'?
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-TN4V3G6', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13.0.2'
Driver info: driver.version: AppiumDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find 'adb.exe' in ["C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\platform-tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\emulator\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\adb.exe","C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest\tools\bin\adb.exe"]. Do you have Android Build Tools installed at 'C:\Users\Bhushan\Documents\Automation Testing 2020\Android SDK Tools\android\cmdline-tools\latest'?
at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
at asyncHandler (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 18 more
Try this
Step 1: You know where your android-sdk is installed in your system. if you didn't changed the location search in ProgramFiles/Android
Step 2: close eclipse.
Step 3: Copy adb.exe in android-sdk/platform-tools/ folder
Step 4: Paste that adb.exe in android-sdk/tools/ folder
Step 5: Now open eclipse go to Windows --> Preferences choose android then click browse and select android-sdk with in few minutes
Android Problem: Eclipse cannot find ADB.exe

Unable to connect the appium server "http://127.0.0.1:4788/wd/hub" and "http://127.0.0.1:4723/wd/hub", method not executing?

Error in SDK:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s ce0616068209b10805 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
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.]
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 26.70 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'DESKTOP-1M92PA5', ip: '10.250.2.20', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:156)
at Appium.AppiumSetupPage.setUp(AppiumSetupPage.java:43)
at Appium.C8_Java.main(C8_Java.java:10)
Error in Appium Server:
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c \"C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s ce0616068209b10805 install \"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk\"\"\nFailed 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,"cmd":"C:\WINDOWS\system32\cmd.exe /s /c \"C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s ce0616068209b10805 install \"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk\"\"","origValue":"Command failed: C:\WINDOWS\system32\cmd.exe /s /c \"C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s ce0616068209b10805 install \"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk\"\"\nFailed 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 26099.816 ms - 1420
This is the known issue with Android N (Android 7.0)
you need to either re-install the server (with the --no-shrinkwrap flag) or go into your Appium installation and run the following npm install command.
npm install appium-adb#2.6.13 --no-shrinkwrap

Error with iOS driver set up

As per the instruction with http://ios-driver.github.io/ios-driver/?page=setup , i am trying to set up ios driver my application first testing using this automation.
I have installed java 7 and downloaded the app in given link. Installed OSX 10.9. While executing the command $ java -jar ios-server-0.6.6-SNAPSHOT-standalone.jar -aut path/to/aut.app -port 4444 i am getting below error
45:08:315 INFO ApplicationStore.<init> App archive folder:/Users/labuser/Downloads/applications
false
45:08:838 SEVERE IOSServer.main cannot start ios-driver server: org.openqa.selenium.WebDriverException: path/to/aut.app isn't an IOS app.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9', java.version: '1.7.0_55'
Driver info: driver.version: unknown
Any one suggest me to resolve this error and am new to use commands in terminal
It looks like path/to/aut.app is a placeholder and you need to replace it with the path to your application.

Resources