Counting elements with the same selector in webdriver.io
问题 I am using webdriver.io with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the webdriver.io API seems to return an array. How can it be achieved? 回答1: This is how you do it: client.elements('.myElements', function(err,res) { console.log('element count: ',res.value.length); }); Explanation: with elements you fetch all elements according given selector. It returns an array of webdriver elements which represents