创建新的无铬对象后:
const chromeless = new Chromeless( { implicitWait: true, scrollBeforeClick: true })
当我在 DOM 中的某个元素上使用 chromeless.click(selector) 时,例如:
await chromeless.click('[automation="backgroundButtons"] button:nth-child(1)')
我收到超时异常:
错误:wait("[automation="backgroundButtons"] button:nth-child(1)") 在 10000 毫秒后超时
但是,当我使用 chromeless.evaluate 方法单击相同的元素时:
function chooseBackgroundColor() {
document.querySelectorAll('[automation="backgroundButtons"] button:nth-child(1)')[0].click()
}
await chromeless.evaluate(chooseBackgroundColor)
它工作得很好。任何想法为什么?它再现了一些其他元素。
提前致谢