How to find an element with webdriver-io that matches multiple data- attributes?

Viewed 420

The webdriverio docs for $ or findElement aren't that extensive, I'm used to other e2e tools, hence the confusion, to find an element that has both attributes I want to achieve something like:

const element = $('[title="HOW TO USE?", data-text="HOW TO USE?"]');

Is this the correct syntax?

WEBDRIVERIO version: 5.6.6

1 Answers

Please try as below.

const element = $('[title="HOW TO USE?"][data-text="HOW TO USE?"]');

Related