mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix page.injectFile and add test. (#52)
This line within `injectFile` wasn't doing much of anything:
```js
let expression = fs.readFile(filePath, 'utf8', (err, data) => callback({err, data}));
```
* That's fixed.
* A path error in examples/features.js is fixed.
* Test added for injectFile.
This commit is contained in:
committed by
Andrey Lushnikov
parent
3d3e8dd038
commit
6c7ae41ae6
@@ -19,7 +19,7 @@ var Browser = require('../lib/Browser');
|
||||
var browser = new Browser();
|
||||
|
||||
browser.newPage().then(async page => {
|
||||
var modernizrPath = path.join('..', 'third_party', 'phantomjs', 'examples', 'modernizr.js');
|
||||
var modernizrPath = path.join(__dirname, '../third_party/phantomjs/examples/modernizr.js');
|
||||
await page.injectFile(modernizrPath);
|
||||
page.on('consolemessage', console.log);
|
||||
await page.evaluate(detectFeatures);
|
||||
|
||||
Reference in New Issue
Block a user