diff --git a/packages/puppeteer-core/src/api/locators/Locator.ts b/packages/puppeteer-core/src/api/locators/Locator.ts index 010c8a7e75b..ca5c8c6588c 100644 --- a/packages/puppeteer-core/src/api/locators/Locator.ts +++ b/packages/puppeteer-core/src/api/locators/Locator.ts @@ -324,10 +324,18 @@ export abstract class Locator extends EventEmitter { return from( handle.frame.page().waitForFunction( element => { - if ('disabled' in element && typeof element.disabled === 'boolean') { - return !element.disabled; + if (!(element instanceof HTMLElement)) { + return true; } - return true; + const isNativeFormControl = [ + 'BUTTON', + 'INPUT', + 'SELECT', + 'TEXTAREA', + 'OPTION', + 'OPTGROUP', + ].includes(element.nodeName); + return !isNativeFormControl || !element.hasAttribute('disabled'); }, { timeout: this._timeout,