I have the following code that uses selenium webdriver to get the text of an element:
async function getText(driver, locator) {
return await (await driver.findElement(locator)).getText();
}
Probably some brain fog on my part, but is there a cleaner way to write this code?
I've got some other functions which will require a few more promise chains - its going to get messy, so I want to find a nice, concise way to write the functions.
The function just needs to return the text, I don't want it to return a promise.