puppeteer

以前用 phantomjs,现在可以用 Puppeteer,不知道这个库能维护多久。phantomjs 能做的事情,Puppeteer 都能做!


* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

*/constpuppeteer=require('puppeteer');(async()=>{constbrowser=awaitpuppeteer.launch();constpage=awaitbrowser.newPage();awaitpage.goto('https://google.com',{waitUntil:'networkidle'});// Type our query into the search barawaitpage.type('puppeteer');awaitpage.click('input[type="submit"]');// Wait for the results to show upawaitpage.waitForSelector('h3 a');// Extract the results from the pageconstlinks=awaitpage.evaluate(()=>{constanchors=Array.from(document.querySelectorAll('h3 a'));returnanchors.map(anchor=>anchor.textContent);});console.log(links.join('\n'));browser.close();})();

➜  puppeteer node search.js

puppeteerの意味 - 英和辞典 Weblio辞書

GitHub - GoogleChrome/puppeteer: Headless Chrome Node API

puppeteerの意味・用例|英辞郎 on the WEB:アルク

--headless時代の本命? Chrome を Node.jsから操作するライブラリ ...

Puppeteer - Wikipedia

Puppeteer (video game) - Wikipedia

puppeteer - ウィクショナリー日本語版

MAX - Puppeteer (OFFICIAL MUSIC VIDEO) - YouTube

Puppeteer: Headless Chrome Node API | Hacker News

Puppeteer™ Game | PS3 - PlayStation

你可能感兴趣的:(puppeteer)