puppeteer

作者: 柚子柠檬水 | 来源:发表于2018-03-11 09:30 被阅读0次

以前用 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

    本文链接:https://www.haomeiwen.com/subject/bcvifftx.html