chore: specialize Locator.prototype.setWaitForEnabled (#10649)

This commit is contained in:
jrandolf 2023-07-27 10:17:27 +02:00 committed by GitHub
parent 448a18310d
commit 16ab291b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,10 +324,18 @@ export abstract class Locator<T> extends EventEmitter {
return from( return from(
handle.frame.page().waitForFunction( handle.frame.page().waitForFunction(
element => { element => {
if ('disabled' in element && typeof element.disabled === 'boolean') { if (!(element instanceof HTMLElement)) {
return !element.disabled; return true;
} }
return true; const isNativeFormControl = [
'BUTTON',
'INPUT',
'SELECT',
'TEXTAREA',
'OPTION',
'OPTGROUP',
].includes(element.nodeName);
return !isNativeFormControl || !element.hasAttribute('disabled');
}, },
{ {
timeout: this._timeout, timeout: this._timeout,