parent
545c43d28d
commit
e312845ba9
|
|
@ -451,7 +451,7 @@ export class Frame {
|
|||
|
||||
const deadline = this._page._timeoutSettings.computeDeadline(options);
|
||||
const { world, task } = selectors._waitForSelectorTask(selector, state, deadline);
|
||||
const result = await this._scheduleRerunnableTask(task, world, deadline, `selector "${selectorToString(selector, state)}"`);
|
||||
const result = await this._scheduleRerunnableTask(task, world, deadline, `selector "${selector}"${state === 'attached' ? '' : ' to be ' + state}`);
|
||||
if (!result.asElement()) {
|
||||
result.dispose();
|
||||
return null;
|
||||
|
|
@ -469,7 +469,7 @@ export class Frame {
|
|||
async dispatchEvent(selector: string, type: string, eventInit?: Object, options?: types.TimeoutOptions): Promise<void> {
|
||||
const deadline = this._page._timeoutSettings.computeDeadline(options);
|
||||
const task = selectors._dispatchEventTask(selector, type, eventInit || {}, deadline);
|
||||
const result = await this._scheduleRerunnableTask(task, 'main', deadline, `selector "${selectorToString(selector, 'attached')}"`);
|
||||
const result = await this._scheduleRerunnableTask(task, 'main', deadline, `selector "${selector}"`);
|
||||
result.dispose();
|
||||
}
|
||||
|
||||
|
|
@ -970,17 +970,6 @@ class RerunnableTask {
|
|||
}
|
||||
}
|
||||
|
||||
function selectorToString(selector: string, state: 'attached' | 'detached' | 'visible' | 'hidden'): string {
|
||||
let label;
|
||||
switch (state) {
|
||||
case 'visible': label = '[visible] '; break;
|
||||
case 'hidden': label = '[hidden] '; break;
|
||||
case 'attached': label = ''; break;
|
||||
case 'detached': label = '[detached]'; break;
|
||||
}
|
||||
return `${label}${selector}`;
|
||||
}
|
||||
|
||||
export class SignalBarrier {
|
||||
private _options: types.NavigatingActionWaitOptions;
|
||||
private _protectCount = 0;
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ describe('Frame.waitForSelector', function() {
|
|||
let error = null;
|
||||
await page.waitForSelector('div', { state: 'hidden', timeout: 1000 }).catch(e => error = e);
|
||||
expect(error).toBeTruthy();
|
||||
expect(error.message).toContain('waiting for selector "[hidden] div" failed: timeout');
|
||||
expect(error.message).toContain('waiting for selector "div" to be hidden failed: timeout');
|
||||
});
|
||||
it('should respond to node attribute mutation', async({page, server}) => {
|
||||
let divFound = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue