Starting Emulator automatically when starting the Appium server (locally)?

Hi,

I’m running Appium locally for testing purposes, with a Maven and TestNG configuration. Now the Appium server is started programmatically when starting the TestNG suite. How can I start the emulator at the same time ? Usually I would use “–avd”. I looked for it in the AppiumServiceBuilder, there seem to be general server flags but not “–avd” ?

When I am using the Appium (Mac) app it also starts the emulator when starting the server with “–avd” so it seems to be possible, but how ?

Would be great if somebody could enlighten me, thanks!

1 Like

Actually now I can answer my question by myself :wink:

public void startAppium(){

    service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
            .withArgument(new ServerArgument(){
                public String getArgument() {
                    return "--avd";
                }
            }, "Nexus5")
            .usingDriverExecutable(new File("/Applications/Appium.app/Contents/Resources/node/bin/node"))
            .withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js"))
            .withLogFile(new File("target/\"+deviceUnderExecution+\".log")));

    service.start();
}
2 Likes

Thanks for coming back with the answer.

Awesome! Thanks :slight_smile:

Good work. Could you please suggest me for ios simulator to launch programmatically.

Can anyone share the code to launch genymotion emulator programmatically

Hi,

Can you please advice me here?

Q: I want to start the Appium server (which is a window UI client) and the emulator (Android studio) automatically with the code.
The code should Start the Appium server and also should start the Emulator “Nexus4”.

Can you please advice me the code for this?

Thanks
SS