mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Node.js API for Chrome
c3a3bfe1d2
The PhantomJS has a similar callback called onInitialized. This callback passes control to the automation script when the page gets initialized. To precisely implement this functionality atop of puppeteer, and since puppeteer controller script lives in a separate process to the page, we need an ability to pause page at the moment of initialization. For now, we are not able to do this. However, oftentimes clients want to evaluate certain code in page at the point of page initialization. This patch implements this capability with the Page.evaluateOnInitilized method call. This patch also re-implements phantom's unrandomize.js example with the puppeteer API. This is serves an illustration purpose for the page.evaluateOnInitilized callback. |
||
---|---|---|
examples | ||
lib | ||
phantomjs | ||
third_party/phantomjs | ||
.gitignore | ||
CONTRIBUTING.md | ||
index.js | ||
install.js | ||
LICENSE | ||
package.json | ||
README.md |
Status
Test results on Mac OS X in headless mode:
111 passed
20 failed as expected
1 skipped
49 unsupported
Installing
npm i
npm link # this adds puppeteer to $PATH
Run
# run phantomjs script
puppeteer third_party/phantomjs/examples/colorwheel.js
# run 'headful'
puppeteer --no-headless third_party/phantomjs/examples/colorwheel.js
# run puppeteer example
node examples/screenshot.js
Tests
Run phantom.js tests using puppeteer:
./third_party/phantomjs/test/run-tests.py