Here's a snippet of code I'm working with:
const wd = require('wd')
const driver = await wd.promiseChainRemote("http://localhost:4723/wd/hub")
elements = await driver.elementsByAccessibilityId("commonElementsId")
I have received a promise object, and now I'm wondering how to retrieve a single element to apply the text() method and get the inner text. I found a solution in Java, but I need help translating it to Javascript. The Java code looks like this:
elements.get(indexOfElement).getText()
Unfortunately, this won't work in JavaScript. Any suggestions?