appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.22k stars 758 forks source link

[Question] How to set up AppiumDriverLocalService #274

Closed saikrishna321 closed 8 years ago

saikrishna321 commented 8 years ago

@TikhomirovSergey is it possible to set the Android UDID when running appium server programmatically, as i'm running my tests in parallel. Can we set the way BOOTSTRAP port is set below?

new AppiumServiceBuilder(). withArgument(AndroidServerFlag.BOOTSTRAP_PORT_NUMBER,"Your port number");

TikhomirovSergey commented 8 years ago

@saikrishna321 Yes. You can

new AppiumServiceBuilder().
withArgument(GeneralServerFlag.UIID,"your UIID");

https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/service/local/flags/GeneralServerFlag.java#L40

If it is enough please close this ticket. Otherwise please provide some more details.

saikrishna321 commented 8 years ago

@TikhomirovSergey Awesome.. :+1: Closing the ticket

saikrishna321 commented 8 years ago

@TikhomirovSergey How can we set the path of LOG_LEVEL, like i want to name the file as udid.txt where should i specify that ?

saikrishna321 commented 8 years ago

(GeneralServerFlag.LOG_LEVEL, "info") i see logs.txt created under ma project dir. How can i specify the path and fileName of this ?

TikhomirovSergey commented 8 years ago

@saikrishna321 You can specify the path to the desired log file this way

new AppiumServiceBuilder().withLogFile(new File("path to the log file"))

Please close it again if the answer is right.

saikrishna321 commented 8 years ago

@TikhomirovSergey Thanks a lot.. very helpfull.. :+1:

any info on how to use SHELL and WebHOOK flag ? Would b great if you can join the gitter room .

TikhomirovSergey commented 8 years ago

@saikrishna321 Sorry Lots af everyday work.

new AppiumServiceBuilder().withArgument(GeneralServerFlag.SHELL). //here I can be wrong
.withArgument(GeneralServerFlag.WEB_HOOK("localhost:9876")); //Also send log output to this HTTP listener

Some flags are boolean. At this case you have only

new AppiumServiceBuilder().withArgument(YOUR_DESIRED_FLAG);

Some flags require values

new AppiumServiceBuilder().withArgument(YOUR_DESIRED_FLAG, "ITS_VALUE");

The full list of flags you can fing here:

http://appium.io/slate/en/master/?ruby#appium-server-arguments

Here are samples. All flags are described in java_cleint via: GeneralServerFlag here are flags for all platforms AndroidServerFlag Android-specific flags IOSServerFlag iOS-specific flags

saikrishna321 commented 8 years ago

@TikhomirovSergey

new AppiumServiceBuilder().withArgument(GeneralServerFlag.SHELL). //here I can be wrong
.withArgument(GeneralServerFlag.WEB_HOOK("localhost:9876")); //Also send log output to this HTTP listener

During the test execution, if i hit localhost:9876 nothing on this port is running

TikhomirovSergey commented 8 years ago

It just was a sample :)

cdewangan commented 8 years ago

Can we run Appium Server as daemon ? Do we have any flag to run AppiumDriverLocalService in background, as it is blocking my code to execute further.

TikhomirovSergey commented 8 years ago

@cdewangan it is most likely you are facing up this issue https://github.com/appium/java-client/issues/283

cdewangan commented 8 years ago

Thats right @TikhomirovSergey , Thanks for letting me know. I will wait for this merge.

TikhomirovSergey commented 8 years ago

If there is no question anymore I'm closing it...

ravikr42 commented 8 years ago

Hi @saikrishna321 @TikhomirovSergey

I am not able to set the device Udid using the code below:

new AppiumServiceBuilder(). withArgument(GeneralServerFlag.UIID,"your UIID");

For me "UIID" flag is not coming in GeneralServerFlag. I am using appium java_client 4.0.0 .

kindly help me on this.

Thanks Ravi

saikrishna321 commented 8 years ago

@ravikr42 its moved to MobileCapabilityType

https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/remote/MobileCapabilityType.java#L73

ravikr42 commented 8 years ago

Hi @saikrishna321 Thank you for your reply. I am trying to supply Udid by shown code below:

DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(MobileCapabilityType.UDID, "UdidValue");

new AppiumServiceBuilder().withCapabilities(caps);

But if I am supplying like this, my Appium server is not getting started.Am I doing wrong? could you please let me know the actual implementation.

After supplying capabilities I am getting output on console like this shown below:

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,awpaprinu:me.rjsr: eorrr,oerrror,e:rro rU:ndreebcuognized arggu,meernrtos: r:-info,er-rdoerf:awuarlnt,-capabielirtrior:erroers, {"udiddebu"g,: "Sodmeebug:debug,debug:i1nf2o3,ew"}. 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]

SrinivasanTarget commented 8 years ago

@ravikr42 Which version of appium server are you using? If it is appium 1.4.x please use the latest server and client which is 1.5.3 & 4.0

ravikr42 commented 8 years ago

Hi @SrinivasanTarget I am using node appium 1.4.16 and appium java client 4.0.0

-Ravi

SrinivasanTarget commented 8 years ago

Uninstall Appium 1.4.x and install Appium1.5.3. Give a try after that, it will work.

On 18-Jul-2016 11:16 PM, "Ravi Kumar" notifications@github.com wrote:

Hi @SrinivasanTarget https://github.com/SrinivasanTarget I am using node appium 1.4.16 and appium java client 4.0.0

-Ravi

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/appium/java-client/issues/274#issuecomment-233403634, or mute the thread https://github.com/notifications/unsubscribe-auth/AIfAJdak4eIRdxS3r2n4z1b8GEPmksQxks5qW7wTgaJpZM4Gq-iT .

ravikr42 commented 8 years ago

@SrinivasanTarget Thank you for your reply.

I will try this and let you know.

Thank you 👍

ravikr42 commented 8 years ago

Hi @SrinivasanTarget

It Worked. Thank you.