[puppeteer] adding missing waitForXPath method (#25609)

* adding missing waitForXPath method

* remove trailing whitespce

* add waitForXPath method usage
This commit is contained in:
Ian Luca
2018-05-08 16:05:54 -03:00
committed by Sheetal Nandi
parent bc47bffd04
commit ad87ac4fda
2 changed files with 12 additions and 1 deletions

View File

@@ -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 {

View File

@@ -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",