schickling/chromeless

Chromeless - click(selector) doesn't always work

nirdavid opened this issue · 0 comments

After creating new chromeless object:

const chromeless = new Chromeless( { implicitWait: true, scrollBeforeClick: true })

When I use chromeless.click(selector) on some element in the DOM, for example:

await chromeless.click('[automation="backgroundButtons"] button:nth-child(1)')

I receive timeout exception:

Error: wait("[automation="backgroundButtons"] button:nth-child(1)") timed out after 10000ms

However, when I click the same element with chromeless.evaluate method:

function chooseBackgroundColor() {
  document.querySelectorAll('[automation="backgroundButtons"] button:nth-child(1)')[0].click()
}

await chromeless.evaluate(chooseBackgroundColor)

It works absolutely fine. Any ideas why? It reproduces for some other elements.

Thanks in advance