mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: specialize Locator.prototype.setWaitForEnabled
(#10649)
This commit is contained in:
parent
448a18310d
commit
16ab291b93
@ -324,10 +324,18 @@ export abstract class Locator<T> 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,
|
||||
|
Loading…
Reference in New Issue
Block a user