I am getting an error when I am launching the appium for android. I started node.js by double ckicking node.js then I gave the path of my apk file and then clicked on launch buttonand in console i got following error:
Starting Node Server
Starting Appium in pre-launch
Pre-launcing app
Using fast reset?false
No app-activity desired capability or server param.Parsing from apk.
No app-package desired capability or server param.Parsing from apk.
Using local app from command line: C:\Users\ssharma\lowes-android-app-Wolverine-Sprint6-2014-04-29_17-03-13.apk
Creating new appium session 4aa75228-984f-46f7-8b09-50221dc19875
starting android appium
Preparing device for session
Checking whether app is actually present
Checking whether adb is actually present
Sent shutdown command,waiting for UiAutomator to stop...
Uiautomator did not shut down fast enough calling it gone
Error:
Node Server Process Ended
Please help me in this issue.
What machine are you running on ? On windows you can use exe and on mac you can use app and then pass correct capabilities from appium client.
Related
I'm running Appium 24/7 on a Windows machine to perform automated tests. I'm running these tests via AVD on an emulator with Android 10. For my test, I give the correct Capabilities and runs functionally great. But after a few hours/days I get the follow error:
UnknownError: An unknown server-side error occurred while processing the command. Original error:*Cannot find any free port in range 8200..8299}. Please set the available port number by providing the systemPort capability or double check the processes that are locking ports within this range and terminate these which are not needed anymore at getResponseForW3CError at asyncHandler.
When my code is executed, I make sure the finally in try executes the AppiumDriverLocalService.stop(); method to kill Appium. My feeling says this does somehow not free up any ports for UIAutomator2 (which you can configure, but I have not configured, through systemPort capability.
} finally {
driver.closeApp();
service.stopServer();
System.exit(0);
}
Why does Appium not free up any ports for UIAutomator2 in the range 8000-8299 after stopping the service?
Android Debug Bridge version 1.0.40
Appium version 1.20.2
Android 10
PS I know of the adb command adb -s $UDID forward --remove-all but does this solve the real issue, I don't want to execute a Java Process each time
Update - Fix 2-3
I have fixed the issue by changing the finally clause to execute the following methods in order:
} finally {
AndroidDriver.quit();
AppiumDriverLocalService.stopServer();
In order to free up the port 8200..8299, AndroidDriver must be quit as UIAutomator2 is linked to this. The AppiumDriverLocalService will kill/forward/free this port and UIAutomator2, after this I can freely stop the server:
[ADB] Removing forwarded port socket connection: 8203
This issue is a good example of your problem. As you can see, Appium team is closing it as a Not A Bug.
Reason is obvious: Appium is not responsible for managing ports, it relies that your system has some free in required (by Appium code) range.
systemPort is used to connect to appium-uiautomator2-server, by default is 8200. Basically Appium selects one port from 8200 to 8299 for appium-uiautomator2-server. However, when you run tests in parallel, you must adjust the port to avoid conflicts. If you are not, you should be safe in 99% cases with the default.
Restart the system (assuming it will clear ports) and run tests. Check Appium server logs for any errors on closing session. It could be that issue is related to ADB setup or permission issue, and UI2 server is not stopped properly.
If so, port remains in use. And it is not Appium to deal with cleanup. I'm not sure that adb command you mentioned is a good 100% guaranteed way to do it.
I would just add a shell script that is executed before Appium server start to clean ports in 8200-8299 range and forget this problem.
killall -9 node - to kill all appium running internally and at root level
and adb kill-server - to kill the abd server by running this it resolved the above issue for me , hope may help someone
I have tried to restart the server with npm start, npx react-native run-ios, npx react-native start. Those commands don't work for me. Help me out to run this project its a project created with npx react native init projectName.
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
The error shown on the emulator
Run adb reverse tcp:8081 tcp:8081 in your terminal then reload in the terminal after running yarn start or npm start, then reload. I hope this is helpful.
I had the same problem and spent hours working on it. I figured out that METRO which is run using this command: npm start or this one npx react-native start couldn't find its way to my mobile app.
one of the solutions that I wasn't totally pleased of was this: a solution that works but has flows
but that workaround wasn't perfect because I had to re-run the command every single time I make a change. So after further researches I found out that the port 8081 is used by an another application that METRO is sending information to ( this is only my guess ). so:
I run the following:
netstat -aon | findstr 8081 // to get the PID of the application that is running on 8081 port
I opened task manager ( CRTL + ALT + del ) under the service section I looked up any
application which uses the PID that matches the one given by the command I ran and I have
forced stopping it.
retried npx react-native start and npx react-native run-android on my project
and the magic happened. It auto refreshes with every change, I wish it helps you.
This is from the docs:
Method 2: Connect via Wi-Fi
You can also connect to the development server over Wi-Fi. You'll
first need to install the app on your device using a USB cable, but
once that has been done you can debug wirelessly by following these
instructions. You'll need your development machine's current IP
address before proceeding.
Open a terminal and type /sbin/ifconfig to find your machine's IP address.
Make sure your laptop and your phone are on the same Wi-Fi network.
Open your React Native app on your device.
You'll see a red screen with an error. This is OK. The following
steps will fix that.
Open the in-app Developer menu.
Go to Dev Settings → Debug server host for device.
Type in your machine's IP address and the port of the local dev
server (e.g. 10.0.1.1:8081).
Go back to the Developer menu and select Reload JS
I want to study details about how the Appium server works, so while studying about the architecture, I am not getting a clear idea about how the session works on Appium server.
There are two components to running Appium automation tests - Appium server and Appium session. Appium server is a REST interface listener, while an Appium session is the entity which makes REST calls to Appium server in order to perform actions such as finding & clicking web elements. The session is tied to a device such as Android emulator or real device.
You can start an Appium server without starting an Appium session, but you cannot start an Appium session without starting an Appium server.
When you have Appium properly installed, you can open the Command prompt & enter appium. You will see a message indicating the Appium REST listener has started, and is listening on a specific address, such as 0.0.0.0:4327.
When you start an Appium session, you have to ensure your session is connecting to the correct port. If you start Appium server on 0.0.0.0:4327, but then try to start a session on 0.0.0.0:5555, the session will not start.
The Appium session uses underlying libraries such as node and Java to interact with web elements. The code is publicly available on https://github.com/appium/appium so you can view the complete architecture and session / server relationship here if you'd like.
I am trying to setup automated tests for an android app using Appium (npm version) but I keep getting the error
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id
[UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command '/usr/local/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200' exited with code 1'; Stderr: 'error: listener 'tcp:8200' not found'; Code: '1''
I have looked around google for ages but havnt been able to find any solution that has actually worked for me, so far totalling 50 failed builds.
If i run the commands on my local machine it works fine but within travis I have no such luck unfortunately. I am new to setting up appium so it could be something minor im not understanding.
A gist of my travis.yml file is here
Distribution:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Thanks in advance.
tcp:8200 is not forwarded and there should be no forwards.
try with adb forward --remove-all, when not knowing which port it is
... if it's even required to remove any forward.
After looking at the logs, I understand that the emulator is not ready to allow UiAutomator to get deployed properly.
So to make sure that emulator is ready, you can use avdLaunchTimeout and avdReadyTimeout by passing 60000 ms to both in your desired capabilities.
Once the emulator is ready, you won't get this error.
I'm using the simulator (iOS 9.0).
I’m running the command: device_target=UDID cucumber
The simulator starts and the app is loading, but then the console hang for few min until time out.
I have the same issue when I run it manually in the console:
calabash-ios console
start_test_server_in_background
The error that I get is:
#<RuntimeError: Timed out connecting to Calabash server after 10 retries. Make sure it is linked and App isn't crashing>
RuntimeError: Unable to make connection to Calabash Server at http://localhost:37265/`
Make sure you don't have a firewall blocking traffic to http://localhost:37265/.
running the command curl http://localhost:37265 and get the error - curl: (7) Failed to connect to localhost port 37265: Connection refused
what I’m missing?
(the app developed in Xamarin)
device_target=UDID cucumber
This is not doing what you expect. Calabash responds to DEVICE_TARGET not device_target.
My best guess is that you need to check whether your .app is linked with Calabash.
Please see these two pages:
https://github.com/calabash/calabash-ios/wiki#reporting-problems
https://github.com/calabash/calabash-ios/wiki/Updating-your-Calabash-iOS-version#what-version-of-the-server-is-embedded-in-my-app