Can we start the Appium server from automation script instead of Appium Client?

Can we start the Appium server from automation script instead of Appium Client?

If Yes, Could you please paste the syntax here.

@shivakrishnach31
This will help :smile:

When I try with the code you said, I got the below error.

[TestNG] Running:
/private/var/folders/jx/ffh_slbj46l55xd0wqb7j7sc0000gp/T/testng-eclipse-122749652/testng-customsuite.xml

usage: appium.js [-h] [-v] [–shell]
[–localizable-strings-dir LOCALIZABLESTRINGSDIR] [–app APP]
[–ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [–session-override] [–full-reset]
[–no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–native-instruments-lib]
[–app-pkg ANDROIDPACKAGE] [–app-activity ANDROIDACTIVITY]
[–app-wait-package ANDROIDWAITPACKAGE]
[–app-wait-activity ANDROIDWAITACTIVITY]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS]
[–device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [–safari]
[–device-name DEVICENAME] [–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME]
[–browser-name BROWSERNAME] [–default-device]
[–force-iphone] [–force-ipad] [–language LANGUAGE]
[–locale LOCALE] [–calendar-format CALENDARFORMAT]
[–orientation ORIENTATION]
[–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–show-sim-log]
[–show-ios-log] [–nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–show-config]
[–no-perms-check] [–command-timeout DEFAULTCOMMANDTIMEOUT]
[–keep-keychains] [–strict-caps] [–isolate-sim-device]
[–tmp TMPDIR] [–trace-dir TRACEDIR]
[–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY]
[–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–debug-log-spacing]
[–suppress-adb-kill-server] [–async-trace]

appium.js: error: argument “-g/–log”: Expected one argument. null
FAILED: f
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: ‘2.45.0’, revision: ‘5017cb8’, time: ‘2015-02-26 23:59:50’
System info: host: ‘pcnicmcdev01’, ip: ‘172.25.11.137’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.2’, java.version: ‘1.8.0_45’
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39)
at androidAppium.NewTest1.f(NewTest1.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:648)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:834)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1142)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1176)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
at org.testng.TestNG.run(TestNG.java:1009)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:4723 [/127.0.0.1] failed: Connection refused
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:319)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:126)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:72)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:133)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
… 31 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:125)
… 44 more

===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0

[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@626b2d4a: 26 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@cac736f: 34 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@123772c4: 8 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@73a28541: 5 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 5 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@4926097b: 7 ms


Code is:

package androidAppium;

import io.appium.java_client.android.AndroidDriver;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteException;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class NewTest1 {
//public static AndroidDriver driver;
@Test
public void f() throws MalformedURLException {
CommandLine command = new CommandLine("/Applications/Appium.app/Contents/Resources/node/bin/node");
//command.addArgument("/Applications/Appium.app/Contents/Resources/node/bin/node",false);
command.addArgument("/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js",false);
command.addArgument("–address",false);
command.addArgument(“127.0.0.1”);
command.addArgument("–port",false);
command.addArgument(“4723”);
//command.addArgument("–full-reset",false);
command.addArgument("–log");
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
executor.execute(command, resultHandler);
} catch (ExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

	File app = new File("/Users/mahesh/Desktop/****.apk");
	DesiredCapabilities caps = new DesiredCapabilities();
	caps.setCapability("deviceName", "XT1022");
	caps.setCapability("platformVersion", "4.4.2");
	caps.setCapability("app", app.getAbsolutePath());
	caps.setCapability("appPackage", "com.****.****");
    AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
 

}

}

That is becaue your server arguments are missing an argument after the –log, you should add an absolute path to a file to save the server logs to it.

Something like:

command.addArgument(“–log”);
command.addArgument(“ABSOLUTE_FILE_PATH”);

1 Like

@Hassan_Radi

As you said the server logs are stored in a separate file. But, the Appium console logs also visible in the Eclipse console.

When I give this

command.addArgument(“–log”);
command.addArgument(“D:\AppiumConsole.txt”);

All the logs are saved in that text file.

I want the Appium console logs alone in a separate file and the further things in the eclipse console.

Also I have a clarification over console mode as debug, could you explain that?

That file should include Appium logs only. All the rest of the logs should be printed in the Eclipse console as normal. I am not sure what is causing that behavior, please provide your Appium logs and code for further investigation.

Overall Eclipse Console log:

[TestNG] Running:
C:\Users\ashokkumarg\AppData\Local\Temp\testng-eclipse–1518959040\testng-customsuite.xml

ERROR: The process “node.exe” not found.

e[33mwarne[39m: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
e[36minfoe[39m: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)
e[36minfoe[39m: Appium REST http interface listener started on 127.0.0.1:4725
e[36minfoe[39m: [debug] Non-default server args: {“address”:“127.0.0.1”,“port”:4725,“fullReset”:true,“log”:“D:\AppiumConsole.txt”}
e[36minfoe[39m: Console LogLevel: debug
e[36minfoe[39m: File LogLevel: debug
Row is not empty
1 8 in Execution_Config
Into Android Desired Capabilities Setup
Row is not empty
7 2 in Execution_Config
Row is not empty
8 2 in Execution_Config
Row is not empty
9 2 in Execution_Config
Row is not empty
10 2 in Execution_Config
Row is not empty
11 2 in Execution_Config
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See Apache log4j 1.2 - Frequently Asked Technical Questions for more info.
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{“desiredCapabilities”:{“avd”:“AutoInsurance”,“platformVersion”:“4.4.2”,“app”:“D:/SOFTWARES/Apks/autoInsurance.apk”,“deviceName”:“emulator-5554”,“platformName”:“Android”}}e[39m
e[36minfoe[39m: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.7.0_51)
e[36minfoe[39m: [debug] No appActivity desired capability or server param. Parsing from apk.
e[36minfoe[39m: [debug] No appPackage desired capability or server param. Parsing from apk.
e[36minfoe[39m: [debug] Using local app from desired caps: D:\SOFTWARES\Apks\autoInsurance.apk
e[36minfoe[39m: [debug] Creating new appium session fb683095-5196-4e95-8bac-e3e961769ef5
e[36minfoe[39m: Starting android appium
e[36minfoe[39m: [debug] Getting Java version
e[36minfoe[39m: Java version is: 1.7.0_51
e[36minfoe[39m: [debug] Checking whether adb is present
e[36minfoe[39m: [debug] Using adb from D:\SOFTWARES\sdk\platform-tools\adb.exe
e[36minfoe[39m: [debug] Parsing package and activity from app manifest
e[36minfoe[39m: [debug] Checking whether aapt is present
e[36minfoe[39m: [debug] Using aapt from D:\SOFTWARES\sdk\build-tools\android-4.2.2\aapt.exe
e[36minfoe[39m: [debug] Extracting package and launch activity from manifest.
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\build-tools\android-4.2.2\aapt.exe dump badging D:\SOFTWARES\Apks\autoInsurance.apk
e[36minfoe[39m: [debug] badging package: com.htcindia.autoinsurance
e[36minfoe[39m: [debug] badging act: com.htcindia.autoinsurance.SplashActivity
e[36minfoe[39m: [debug] Parsed package and activity are: com.htcindia.autoinsurance/com.htcindia.autoinsurance.SplashActivity
e[36minfoe[39m: [debug] Set chromedriver binary as: D:\programfiles\node_modules\appium\build\chromedriver\windows\chromedriver.exe
e[36minfoe[39m: [debug] Using fast reset? false
e[36minfoe[39m: [debug] Preparing device for session
e[36minfoe[39m: [debug] Checking whether app is actually present
e[36minfoe[39m: [debug] Trying to find AutoInsurance emulator
e[36minfoe[39m: [debug] Getting connected emulators
e[36minfoe[39m: [debug] Getting connected devices…
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe devices
e[36minfoe[39m: [debug] 1 device(s) connected
e[36minfoe[39m: [debug] 1 emulator(s) connected
e[36minfoe[39m: [debug] Sending telnet command to device: avd name
e[36minfoe[39m: [debug] Getting running emulator port
e[36minfoe[39m: [debug] Socket connection to device created
e[36minfoe[39m: [debug] Socket connection to device ready
e[36minfoe[39m: [debug] Telnet command got response: AutoInsurance
e[36minfoe[39m: [debug] Found emulator AutoInsurance in port 5554
e[36minfoe[39m: [debug] Setting device id to emulator-5554
e[36minfoe[39m: [debug] Did not launch AVD because it was already running.
e[36minfoe[39m: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “echo ‘ready’”
e[36minfoe[39m: [debug] Starting logcat capture
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop ro.build.version.sdk”
e[36minfoe[39m: [debug] Device is at API Level 19
e[36minfoe[39m: Device API level is: 19
e[36minfoe[39m: [debug] Extracting strings for language: default
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop persist.sys.language”
e[36minfoe[39m: [debug] Current device persist.sys.language: en
e[36minfoe[39m: [debug] java -jar “D:\programfiles\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “D:\SOFTWARES\Apks\autoInsurance.apk” “C:\Users\ASHOKK~1\AppData\Local\Temp\com.htcindia.autoinsurance” en
e[36minfoe[39m: [debug] No strings.xml for language ‘en’, getting default strings.xml
e[36minfoe[39m: [debug] java -jar “D:\programfiles\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “D:\SOFTWARES\Apks\autoInsurance.apk” “C:\Users\ASHOKK~1\AppData\Local\Temp\com.htcindia.autoinsurance”
e[36minfoe[39m: [debug] Reading strings from converted strings.json
e[36minfoe[39m: [debug] Setting language to default
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 push “C:\Users\ASHOKK~1\AppData\Local\Temp\com.htcindia.autoinsurance\strings.json” /data/local/tmp
e[36minfoe[39m: [debug] Checking whether aapt is present
e[36minfoe[39m: [debug] Using aapt from D:\SOFTWARES\sdk\build-tools\android-4.2.2\aapt.exe
e[36minfoe[39m: [debug] Retrieving process from manifest.
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\build-tools\android-4.2.2\aapt.exe dump xmltree D:\SOFTWARES\Apks\autoInsurance.apk AndroidManifest.xml
e[36minfoe[39m: [debug] Set app process to: com.htcindia.autoinsurance
e[36minfoe[39m: [debug] Uninstalling com.htcindia.autoinsurance
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “am force-stop com.htcindia.autoinsurance”
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 uninstall com.htcindia.autoinsurance
e[36minfoe[39m: [debug] App was uninstalled
e[36minfoe[39m: [debug] Checking app cert for D:\SOFTWARES\Apks\autoInsurance.apk.
e[36minfoe[39m: [debug] executing cmd: java -jar D:\programfiles\node_modules\appium\node_modules\appium-adb\jars\verify.jar D:\SOFTWARES\Apks\autoInsurance.apk
e[36minfoe[39m: [debug] App already signed.
e[36minfoe[39m: [debug] Zip-aligning D:\SOFTWARES\Apks\autoInsurance.apk
e[36minfoe[39m: [debug] Checking whether zipalign is present
e[36minfoe[39m: [debug] Using zipalign from D:\SOFTWARES\sdk\tools\zipalign.exe
e[36minfoe[39m: [debug] Zip-aligning apk.
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\tools\zipalign.exe -f 4 D:\SOFTWARES\Apks\autoInsurance.apk C:\Users\ASHOKK~1\AppData\Local\Temp\11566-5900-1255dsr\appium.tmp
e[36minfoe[39m: [debug] MD5 for app is 0558b16961dfb119afe15696d2e3ff60
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “ls /data/local/tmp/0558b16961dfb119afe15696d2e3ff60.apk”
e[36minfoe[39m: [debug] Getting install status for com.htcindia.autoinsurance
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop ro.build.version.sdk”
e[36minfoe[39m: [debug] Device is at API Level 19
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “pm list packages -3 com.htcindia.autoinsurance”
e[36minfoe[39m: [debug] App is not installed
e[36minfoe[39m: Installing App
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “mkdir -p /data/local/tmp/”
e[36minfoe[39m: [debug] Removing any old apks
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “ls /data/local/tmp/*.apk”
e[36minfoe[39m: [debug] Found an apk we want to keep at /data/local/tmp/0558b16961dfb119afe15696d2e3ff60.apk
e[36minfoe[39m: [debug] Couldn’t find any apks to remove
e[36minfoe[39m: [debug] Uninstalling com.htcindia.autoinsurance
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “am force-stop com.htcindia.autoinsurance”
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 uninstall com.htcindia.autoinsurance
e[36minfoe[39m: [debug] App was not uninstalled, maybe it wasn’t on device?
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “pm install -r /data/local/tmp/0558b16961dfb119afe15696d2e3ff60.apk”
e[36minfoe[39m: [debug] Forwarding system:4724 to device:4724
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724
e[36minfoe[39m: [debug] Pushing appium bootstrap to device…
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 push “D:\programfiles\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
e[36minfoe[39m: [debug] Pushing settings apk to device…
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 install “D:\programfiles\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
e[36minfoe[39m: [debug] Pushing unlock helper app to device…
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 install “D:\programfiles\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
e[36minfoe[39m: Starting App
e[36minfoe[39m: [debug] Attempting to kill all ‘uiautomator’ processes
e[36minfoe[39m: [debug] Getting all processes with ‘uiautomator’
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “ps ‘uiautomator’”
e[36minfoe[39m: [debug] No matching processes found
e[36minfoe[39m: [debug] Running bootstrap
e[36minfoe[39m: [debug] spawning: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.htcindia.autoinsurance -e disableAndroidWatchers false
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] WARNING: linker:e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunnere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrape[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1e[39m
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Loading json…
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] json loading complete.
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
e[36minfoe[39m: [debug] Waking up device if it’s not alive
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“wake”,{}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Client connected
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “dumpsys window”
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: wake
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
e[36minfoe[39m: [debug] Screen already unlocked, continuing.
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“/data”,“status”:0}
e[36minfoe[39m: [debug] dataDir set to: /data
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop ro.build.version.sdk”
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:false,“status”:0}
e[36minfoe[39m: [debug] Device is at API Level 19
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.htcindia.autoinsurance/com.htcindia.autoinsurance.SplashActivity”
e[36minfoe[39m: [debug] Waiting for pkg “com.htcindia.autoinsurance” and activity “com.htcindia.autoinsurance.SplashActivity” to be focused
e[36minfoe[39m: [debug] Getting focused package and activity
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “dumpsys window windows”
e[36minfoe[39m: [debug] executing cmd: D:\SOFTWARES\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop ro.build.version.release”
e[36minfoe[39m: [debug] Device is at release version 4.4.2
e[36minfoe[39m: [debug] Device launched! Ready for commands
e[36minfoe[39m: [debug] Setting command timeout to the default of 60 secs
e[36minfoe[39m: [debug] Appium session started with sessionId fb683095-5196-4e95-8bac-e3e961769ef5
e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[36m303e[39me[90m 8791.481 ms - 74e[39m e[90me[39m
e[36minfoe[39m: e[37m–>e[39m e[37mGETe[39m e[37m/wd/hub/session/fb683095-5196-4e95-8bac-e3e961769ef5e[39m e[90m{}e[39m
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“4.4.2”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“avd”:“AutoInsurance”,“platformVersion”:“4.4.2”,“app”:“D:/SOFTWARES/Apks/autoInsurance.apk”,“deviceName”:“emulator-5554”,“platformName”:“Android”},“avd”:“AutoInsurance”,“app”:“D:/SOFTWARES/Apks/autoInsurance.apk”,“deviceName”:“emulator-5554”,“platformName”:“Android”},“sessionId”:“fb683095-5196-4e95-8bac-e3e961769ef5”}
e[36minfoe[39m: e[37m<-- GET /wd/hub/session/fb683095-5196-4e95-8bac-e3e961769ef5 e[39me[32m200e[39me[90m 2.230 ms - 595e[39m e[90m{“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“4.4.2”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“avd”:“AutoInsurance”,“platformVersion”:“4.4.2”,“app”:“D:/SOFTWARES/Apks/autoInsurance.apk”,“deviceName”:“emulator-5554”,“platformName”:“Android”},“avd”:“AutoInsurance”,“app”:“D:/SOFTWARES/Apks/autoInsurance.apk”,“deviceName”:“emulator-5554”,“platformName”:“Android”},“sessionId”:“fb683095-5196-4e95-8bac-e3e961769ef5”}e[39m

Appium SetUp for Android is successful and Appium Driver is launched successfully

Hello @ashokkumarg,
I think I misunderstood you at first; Appium logs are stored in a separate file as you requested, but they would still show up in your IDE’s console screen as this is the normal behavior. If you want to separate the two logs in two separate streams, I suggest using a logger like Log4j instead of the normal System.out.println. Make sure to save your Log4j logs to an external file.

Hope that helps and sorry for the misunderstanding :smile:.
Hassan

1 Like

Thanks @Hassan_Radi In Appium settings there is an option called as “Quiet Logging”. That operation is not working when I run in GUI mode.
Do I need to pass it via command line arguments. If so how can be done?

@Hassan_Radi The topic goes in irrelevant thread. Let us switch over to the new discussion topic

@Hassan_Radi I am still getting the same error even after adding the log file Path as argument in very next line of --log line. What would have been the problem for this?

@ashokkumarg
logs please in order to be able to help you :smile:

@Hassan_Radi,

Can you please tell me,how can we start appium server progmatically .As i have to run my Appium Automated test cases through pipelines