puppeteer/experimental/puppeteer-firefox
2019-02-01 18:40:40 -08:00
..
.ci feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
examples feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
lib feat(ppfox): implement browser contexts (#3872) 2019-02-01 14:09:18 -08:00
misc fix(ppfox): check directory existance if necessary when running tests (#3871) 2019-01-31 17:30:34 -08:00
test test(firefox): add puppeteer-firefox unique evaluation tests (#3891) 2019-02-01 18:40:40 -08:00
.cirrus.yml feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
.gitignore feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
.npmignore feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
completeness.sh feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
Errors.js feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
index.js feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
install.js chore(juggler): Roll Firefox to 120450a2 (#3842) 2019-01-25 15:25:54 -05:00
LICENSE feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00
package.json test(firefox): run puppeteer-firefox tests in browser contexts (#3887) 2019-02-01 14:52:25 -08:00
README.md docs(readme): fix pptrfx readme (#3634) 2018-12-06 12:39:03 -08:00
tsconfig.json feat: introduce puppeteer-firefox (#3628) 2018-12-06 11:24:00 -08:00

Puppeteer for Firefox

Use Puppeteer's API with Firefox

BEWARE: This project is experimental. 🐊 live here.

Getting Started

Installation

To use Puppeteer with Firefox in your project, run:

npm i puppeteer-firefox
# or "yarn add puppeteer-firefox"

Note: When you install puppeteer-firefox, it downloads a custom-built Firefox (Firefox/63.0.4) that is guaranteed to work with the API.

Usage

Example - navigating to https://example.com and saving a screenshot as example.png:

Save file as example.js

const pptrFirefox = require('puppeteer-firefox');

(async () => {
  const browser = await pptrFirefox.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({path: 'example.png'});
  await browser.close();
})();

Execute script on the command line

node example.js

API Status

Big lacking parts:

  • page.emulate
  • page.pdf
  • all network-related APIs: page.on('request'), page.on('response'), and request interception

Supported API:

  • class: Puppeteer
    • puppeteer.executablePath()
    • puppeteer.launch([options])
  • class: Browser
    • event: 'targetchanged'
    • event: 'targetcreated'
    • event: 'targetdestroyed'
    • browser.close()
    • browser.newPage()
    • browser.pages()
    • browser.process()
    • browser.targets()
    • browser.userAgent()
    • browser.version()
    • browser.waitForTarget(predicate[, options])
  • class: Target
    • target.browser()
    • target.page()
    • target.type()
    • target.url()
  • class: Page
    • event: 'close'
    • event: 'console'
    • event: 'dialog'
    • event: 'domcontentloaded'
    • event: 'frameattached'
    • event: 'framedetached'
    • event: 'framenavigated'
    • event: 'load'
    • event: 'pageerror'
    • page.$(selector)
    • page.$$(selector)
    • page.$$eval(selector, pageFunction[, ...args])
    • page.$eval(selector, pageFunction[, ...args])
    • page.$x(expression)
    • page.addScriptTag(options)
    • page.addStyleTag(options)
    • page.browser()
    • page.click(selector[, options])
    • page.close(options)
    • page.content()
    • page.evaluate(pageFunction, ...args)
    • page.evaluateOnNewDocument(pageFunction, ...args)
    • page.focus(selector)
    • page.frames()
    • page.goBack(options)
    • page.goForward(options)
    • page.goto(url, options)
    • page.hover(selector)
    • page.isClosed()
    • page.keyboard
    • page.mainFrame()
    • page.mouse
    • page.reload(options)
    • page.screenshot([options])
    • page.select(selector, ...values)
    • page.setContent(html)
    • page.setViewport(viewport)
    • page.target()
    • page.title()
    • page.type(selector, text[, options])
    • page.url()
    • page.viewport()
    • page.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])
    • page.waitForFunction(pageFunction[, options[, ...args]])
    • page.waitForNavigation(options)
    • page.waitForSelector(selector[, options])
    • page.waitForXPath(xpath[, options])
  • class: Frame
    • frame.$(selector)
    • frame.$$(selector)
    • frame.$$eval(selector, pageFunction[, ...args])
    • frame.$eval(selector, pageFunction[, ...args])
    • frame.$x(expression)
    • frame.addScriptTag(options)
    • frame.addStyleTag(options)
    • frame.childFrames()
    • frame.click(selector[, options])
    • frame.content()
    • frame.evaluate(pageFunction, ...args)
    • frame.focus(selector)
    • frame.hover(selector)
    • frame.isDetached()
    • frame.name()
    • frame.parentFrame()
    • frame.select(selector, ...values)
    • frame.setContent(html)
    • frame.title()
    • frame.type(selector, text[, options])
    • frame.url()
    • frame.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])
    • frame.waitForFunction(pageFunction[, options[, ...args]])
    • frame.waitForSelector(selector[, options])
    • frame.waitForXPath(xpath[, options])
  • class: JSHandle
    • jsHandle.asElement()
    • jsHandle.dispose()
    • jsHandle.getProperties()
    • jsHandle.getProperty(propertyName)
    • jsHandle.jsonValue()
    • jsHandle.toString()
  • class: ElementHandle
    • elementHandle.$(selector)
    • elementHandle.$$(selector)
    • elementHandle.$$eval(selector, pageFunction, ...args)
    • elementHandle.$eval(selector, pageFunction, ...args)
    • elementHandle.$x(expression)
    • elementHandle.boundingBox()
    • elementHandle.click([options])
    • elementHandle.dispose()
    • elementHandle.focus()
    • elementHandle.hover()
    • elementHandle.isIntersectingViewport()
    • elementHandle.press(key[, options])
    • elementHandle.screenshot([options])
    • elementHandle.type(text[, options])
  • class: Keyboard
    • keyboard.down(key[, options])
    • keyboard.press(key[, options])
    • keyboard.sendCharacter(char)
    • keyboard.type(text, options)
    • keyboard.up(key)
  • class: Mouse
    • mouse.click(x, y, [options])
    • mouse.down([options])
    • mouse.move(x, y, [options])
    • mouse.up([options])
  • class: Dialog
    • dialog.accept([promptText])
    • dialog.defaultValue()
    • dialog.dismiss()
    • dialog.message()
    • dialog.type()
  • class: ConsoleMessage
    • consoleMessage.args()
    • consoleMessage.text()
    • consoleMessage.type()
  • class: TimeoutError

Special thanks to Amine Bouhlali who volunteered the puppeteer-firefox NPM package.