playwright-fluent
Version:
Fluent API around playwright
19 lines (18 loc) • 651 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentUrl = void 0;
async function getCurrentUrl(page) {
if (page) {
try {
const url = await page.evaluate(() => window.location.href);
return url;
}
catch (error) {
// eslint-disable-next-line no-console
console.warn(`An internal error has occured in Playwright API while evaluating current url : `, error);
return `${error}`;
}
}
throw new Error('Cannot get current page url because no browser has been launched');
}
exports.getCurrentUrl = getCurrentUrl;
;