Android 切换 到 webview 上下文后获取不到页面元素

## 环境:
Android 5.0,真机

## 代码:
document.getElementsByClassName('test1')[1].click()
document.getElementById('test2').click()

错误日志:

Error: [eval("document.getElementsByClassName('test1')[1].click()")] Error response
status: 13, , UnknownError - An unknown server-side error occurred while
processing the command. Selenium error: unknown error: Cannot read property 'click' of null

Error: [eval("document.getElementById('test2').click()")] Error response
status: 13, , UnknownError - An unknown server-side error occurred while
processing the command. Selenium error: unknown error: Cannot read property 'click' of null


↙↙↙阅读原文可查看相关链接,并与作者交流