client.findElement is not a function

I am trying to write test cases using mocha and Appium to test my react-native built app.

I am able to connect to emulator, but then hitting a dead end and getting the erro -
“client.findElement is not a function” when trying to run the following test case -

var webdriverio = require('webdriverio');
var expect = require('chai').expect;
var config = require('./helpers/desiredCapabilities').options;
const client = webdriverio.remote(config);

describe('Original testin',function(){
it('login successfully', function(){
  return  client.findElement("~LOGIN").click().then((val)=>{

Anyone got this resolved? I have the same issue.

The Appium tutorial is really terrible. Getting the code working seems never possible.

Got it resolved by myself. You should await the invocation to remote() (and almost everything else) so that you get back a full object. Try code as below:

const wdio = require("webdriverio");

const opts = {
    port: 4723,
    capabilities: {
        platformName: "Android",
        platformVersion: "9",
        deviceName: "Pixel 2 API 28 Pie",
        //app: "ApiDemos-debug.apk",
        app: "",
        automationName: "UiAutomator2"

(async () => {
    const client = await wdio.remote(opts);


    const field =   await client.$("~Text");;