fix: use handle frame instead of page (#10676)
This commit is contained in:
parent
9a814a3656
commit
1b44b911d3
@ -322,7 +322,7 @@ export abstract class Locator<T> extends EventEmitter {
|
|||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
return from(
|
return from(
|
||||||
handle.frame.page().waitForFunction(
|
handle.frame.waitForFunction(
|
||||||
element => {
|
element => {
|
||||||
if (!(element instanceof HTMLElement)) {
|
if (!(element instanceof HTMLElement)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -965,6 +965,12 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["PASS"]
|
"expectations": ["PASS"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[locator.spec] Locator Locator.click should work with a OOPIF",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[mouse.spec] Mouse should click the document",
|
"testIdPattern": "[mouse.spec] Mouse should click the document",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
@ -287,6 +287,31 @@ describe('Locator', function () {
|
|||||||
clock.restore();
|
clock.restore();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should work with a OOPIF', async () => {
|
||||||
|
const {page} = await getTestState();
|
||||||
|
|
||||||
|
await page.setViewport({width: 500, height: 500});
|
||||||
|
await page.setContent(`
|
||||||
|
<iframe src="data:text/html,<button onclick="this.innerText = 'clicked';">test</button>"></iframe>
|
||||||
|
`);
|
||||||
|
const frame = await page.waitForFrame(frame => {
|
||||||
|
return frame.url().startsWith('data');
|
||||||
|
});
|
||||||
|
let willClick = false;
|
||||||
|
await frame
|
||||||
|
.locator('button')
|
||||||
|
.on(LocatorEmittedEvents.Action, () => {
|
||||||
|
willClick = true;
|
||||||
|
})
|
||||||
|
.click();
|
||||||
|
const button = await frame.$('button');
|
||||||
|
const text = await button?.evaluate(el => {
|
||||||
|
return el.innerText;
|
||||||
|
});
|
||||||
|
expect(text).toBe('clicked');
|
||||||
|
expect(willClick).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Locator.hover', function () {
|
describe('Locator.hover', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user