0.1.0 • Published 8 years ago
puppeteer-find v0.1.0
Find for Puppeteer
Simple yet powerful DOM querying API
Overview
All functionality is exposed in one function: find([ElementHandle $root], Array<Query> queries, [boolean returnId]).
Let's take a closer look at those parameters.
$root: an optional ElementHandle that serves as the root of the search. When left out, thedocumentwill be used.returnId: because Puppeteer doesn't support returning HTML elements (yet?), we just assign an ID to the resulting element (if it doesn't already have one) and return that. WhenreturnIdis set totrue,find()will just return that ID. Whenfalse, it will do an extra query and return the ElementHandle corresponding to the resulting element.queries: this is the heart of the module, the place where all magic happens.queriesis an array of Query objects, which consist of a selector and awhereclause, containing some conditions.
0.1.0
8 years ago