Please help with simple JavaScript example

Hello there,

i try to create my first Appium Test and want to use JavaScript for the Appium Client to be used within some existing NodeJS project.

I followed the getting started instructions for a JS Client here
https://appium.io/docs/en/about-appium/getting-started/index.html

Now i would like to adjust this example to start a pre installed app on my emulator instead of using “app” inside the caps. Is this possible?

The App is not starting, here´s the code i tried:

// javascript
const wdio = require('webdriverio');

// javascript
const opts = {
  port: 4723,
  desiredCapabilities: {
    platformName: "Android",
    platformVersion: "6.0",
    deviceName: "emulator-5554",
    //app: "/root/example/ApiDemos-debug.apk",
    appPackage: "com.whatsapp",
    appActivity: "com.whatsapp.HomeActivity",
    automationName: "UiAutomator2"
  }
};

const client = wdio.remote(opts);

// javascript
client
  .init()
  .click("~App")
  .click("~Alert Dialogs")
  .back()
  .back()
  .end();

Another problem is that i see absolutely no logs to the terminal after executing…

node mytest.js

If everything is set up correctly, you’ll see Appium begin spitting out lots of logs

You won’t see any logs in the actual client execution but the Appium server you have running will produce logs.

Ok thanks for letting me know i figured out showing some logs right to the terminal session.