UNPKG

webdriverio-workflo

Version:

This is a customized version of webdriverio for use with workflo framework.

30 lines (26 loc) 856 B
/** * * Get the element on the page that currently has focus. The element will be returned as a WebElement JSON object. * * @return {String} A WebElement JSON object for the active element. * * @see https://w3c.github.io/webdriver/webdriver-spec.html#get-active-element * @type protocol * */ export default function elementActive () { const requestOptions = { path: '/session/:sessionId/element/active', method: 'POST' } return this.requestHandler.create(requestOptions).catch((err) => { /** * jsonwire command not supported try webdriver endpoint */ if (err.message.match(/(did not match a known command|is not supported for command)/)) { requestOptions.method = 'GET' return this.requestHandler.create(requestOptions) } throw err }) }