How to run appium on headless Linux - jenkins

How do I run tests in headless fashion (for web testing I use XVFB for running browser tests in headless on Jenkins), so how it will work for automation on AVD/Device
I am trying to run a mobile web test using appium on Centos 6 headless linux but I am keep getting this error:
"info: [CHROMEDRIVER STDERR] No protocol specified
info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error
occurred while processing the command.","origValue":"**unknown error: an X display is required for
keycode onversions, consider using Xvfb\n** (Session info: chrome=webview)\n
(Driver info:chromedriver=2.9.248316,platform=Linux 2.6.32042stab088.4x86_64)"},
"sessionId":"8563fbe5972f3ba87673c7a082d49d22"}POST /wd/hub/session/8563fbe5972f3ba87673c7a082d49d22/element/0.06753459526225924-1/value 500 1927ms - 395b
debug: Appium request initiated at /wd/hub/session/8563fbe5972f3ba87673c7a082d49d22
debug: Request received with params: {}
info: Shutting down appium session..."
It opens up the chrome browser and navigates to the given url. After that it tries sendKeys to the username field and then it fails.

We just had this issue and solved it by wrapping the appium server call in a call to xvfb:
xvfb-run appium --session-override --command-timeout=0 &
(or whatever you appium server settings are)
xvfb-run will then handle the headless server setup and shutdown for you.

Related

I am getting an error while running test on headspin environment:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: 'GET /window/current/size' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details
I am not using appium server provided by headspin

How session works on client-server architecture of Appium?

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.

Selenium grid Console showing "[/127.0.0.1] failed: Connection refused"

Please refer to attached screen shot. I've registed 2 emulators to Selenium HUB ( started appium server for each of them )
But it's showing this error message, I'm not sure what does it mean ? Is there something I'm doing wrong ?
Please clarify
To keep it simple I tried launching HUB and registering appium nodes from command line
I got below output from command line
appium --nodeconfig EMULATOR_Nexus_4_1.json
[Appium] Welcome to Appium v1.6.3
[Appium] Non-default server args:
[Appium] nodeconfig: 'EMULATOR_Nexus_4_1.json'
[debug] [Appium] Starting auto register thread for grid. Will try to register every 5000 ms.
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[debug] [Appium] Appium successfully registered with the grid on localhost:4444
But on hub console, still seeing same error per screen shot. Not sure what may be going wrong here ?
node config file entry was wrong earlier.
Worked with below
{"capabilities":[{"browserName":"Nexus_4_1","version":"4.4.2","maxInstances":1,"platform":"ANDROID"}],"configuration":{"nodeTimeout":120,"port":4723,"hubPort":4444,"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","hubHost":"127.0.0.1", "nodePolling":2000, "registerCycle":10000,"register":true,"cleanUpCycle":2000,"timeout":30000,"maxSession":1}}
Refereed to http://www.vimalselvam.com/2016/05/15/selenium-grid-for-appium-mobile-automation/

calabash-ios: The app hangs when running automation

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

Error when launching using appium

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.

Resources