I have rendered two tr
elements onto a browser window. I'd like to click the second one. Based on the webdriver docs, I figured the code would be as follows (using ava):
test('onclick should fire', async t => {
const [, tr] = await t.context.app.client.$$('tr')
await tr.click()
t.true(/* some assertion */)
})
but this yields the following error:
Rejected promise returned by test. Reason:
TypeError {
message: 'tr.click is not a function',
}
Checking out some other stack posts, you can click a selector via it's xPath:
await t.context.app.client.click('//button')
And this actually works, but I'd prefer the first method, whereby you use a selector to choose an element, then call the click
method on it. Is this possible?