How to click on an element with JS - WDIO?

How can I click on an element with JS - WDIO?

Hello Alex,

You can add click() command with JS-WDIO. Please refer to the sample below:

//single_test.js
var assert = require('assert');

describe('Lambdatest Demo Test', function() {
  it('Lambdatest Demo TestCase', function () {
    browser
      .url('https://lambdatest.github.io/sample-todo-app/')
      .click('*[name="li1"]')
      .click('*[name="li2"]')
      .setValue('*[id="sampletodotext"]','Lambdatest\n');
    
    assert(browser.getTitle().match(/Sample page - lambdatest.com/i));
  });
});