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(
|
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user