mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-21 00:28:23 +08:00
[puppeteer] adding missing waitForXPath method (#25609)
* adding missing waitForXPath method * remove trailing whitespce * add waitForXPath method usage
This commit is contained in:
5
types/puppeteer/index.d.ts
vendored
5
types/puppeteer/index.d.ts
vendored
@@ -900,6 +900,11 @@ export interface FrameBase {
|
||||
selector: string,
|
||||
options?: { visible?: boolean; hidden?: boolean; timeout?: number }
|
||||
): Promise<ElementHandle>;
|
||||
|
||||
waitForXPath(
|
||||
xpath: string,
|
||||
options?: { visible?: boolean; hidden?: boolean; timeout?: number }
|
||||
): Promise<ElementHandle>;
|
||||
}
|
||||
|
||||
export interface Frame extends FrameBase {
|
||||
|
||||
@@ -117,9 +117,15 @@ puppeteer.launch().then(async browser => {
|
||||
await watchDog;
|
||||
|
||||
let currentURL: string;
|
||||
|
||||
page
|
||||
.waitForSelector("img", { visible: true })
|
||||
.then(() => console.log("First URL with image: " + currentURL));
|
||||
.then(() => console.log("First URL with image by selector: " + currentURL));
|
||||
|
||||
page
|
||||
.waitForXPath("//img", { visible: true })
|
||||
.then(() => console.log("First URL with image by xpath: " + currentURL));
|
||||
|
||||
for (currentURL of [
|
||||
"https://example.com",
|
||||
"https://google.com",
|
||||
|
||||
Reference in New Issue
Block a user