提交 440117aa 编写于 作者: J Joao Moreno

smoketest: report current active element when failed

related to #49117
上级 56850bb1
......@@ -115,7 +115,18 @@ class WindowDriver implements IWindowDriver {
async isActiveElement(selector: string): TPromise<boolean> {
const element = document.querySelector(selector);
return element === document.activeElement;
if (element !== document.activeElement) {
const el = document.activeElement;
const tagName = el.tagName;
const id = el.id ? `#${el.id}` : '';
const classes = el.className.split(/\W+/g).map(c => c.trim()).filter(c => !!c).map(c => `.${c}`).join('');
const current = `${tagName}${id}${classes}`;
throw new Error(`Active element not found. Current active element is '${current}'`);
}
return true;
}
async getElements(selector: string, recursive: boolean): TPromise<IElement[]> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册