* 聚焦元素 * * @param {string} selector - CSS 选择器 * @returns {ZBrowserClient} this
(selector)
| 619 | * @returns {ZBrowserClient} this |
| 620 | */ |
| 621 | focus(selector) { |
| 622 | return this.evaluate((selector) => { |
| 623 | const el = document.querySelector(selector) |
| 624 | if (!el) { |
| 625 | throw new Error('focus: unable to find element by selector "' + selector + '"') |
| 626 | } |
| 627 | el.focus() |
| 628 | }, selector) |
| 629 | } |
| 630 | |
| 631 | /** |
| 632 | * 滚动页面 |
no test coverage detected