mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
parent
1315dc8234
commit
f1a14fec5b
@ -1,4 +1,5 @@
|
|||||||
const {assert, debugError} = require('./helper');
|
const {assert, debugError} = require('./helper');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
class JSHandle {
|
class JSHandle {
|
||||||
|
|
||||||
@ -327,6 +328,18 @@ class ElementHandle extends JSHandle {
|
|||||||
await this._frame._page.mouse.click(x, y, options);
|
await this._frame._page.mouse.click(x, y, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {!Array<string>} filePaths
|
||||||
|
*/
|
||||||
|
async uploadFile(...filePaths) {
|
||||||
|
const files = filePaths.map(filePath => path.resolve(filePath));
|
||||||
|
await this._session.send('Page.setFileInputFiles', {
|
||||||
|
frameId: this._frameId,
|
||||||
|
objectId: this._objectId,
|
||||||
|
files,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async hover() {
|
async hover() {
|
||||||
await this._scrollIntoViewIfNeeded();
|
await this._scrollIntoViewIfNeeded();
|
||||||
const {x, y} = await this._clickablePoint();
|
const {x, y} = await this._clickablePoint();
|
||||||
|
@ -26,6 +26,10 @@ pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
|
|||||||
// (bug 1176798, bug 1177018, bug 1210465)
|
// (bug 1176798, bug 1177018, bug 1210465)
|
||||||
pref("apz.content_response_timeout", 60000);
|
pref("apz.content_response_timeout", 60000);
|
||||||
|
|
||||||
|
// Allow creating files in content process - required for
|
||||||
|
// |Page.setFileInputFiles| protocol method.
|
||||||
|
pref("dom.file.createInChild", true);
|
||||||
|
|
||||||
// Indicate that the download panel has been shown once so that
|
// Indicate that the download panel has been shown once so that
|
||||||
// whichever download test runs first doesn't show the popup
|
// whichever download test runs first doesn't show the popup
|
||||||
// inconsistently.
|
// inconsistently.
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"node": ">=8.9.4"
|
"node": ">=8.9.4"
|
||||||
},
|
},
|
||||||
"puppeteer": {
|
"puppeteer": {
|
||||||
"firefox_revision": "86e93329fd528bd28ff1493f117f126b6f010eac"
|
"firefox_revision": "e0433ecec0642eca12cba778b0587ab2ae06e833"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "node install.js",
|
"install": "node install.js",
|
||||||
|
@ -21,7 +21,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
describe('input', function() {
|
describe('input', function() {
|
||||||
it_fails_ffox('should upload the file', async({page, server}) => {
|
it('should upload the file', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/fileupload.html');
|
await page.goto(server.PREFIX + '/input/fileupload.html');
|
||||||
const filePath = path.relative(process.cwd(), __dirname + '/assets/file-to-upload.txt');
|
const filePath = path.relative(process.cwd(), __dirname + '/assets/file-to-upload.txt');
|
||||||
const input = await page.$('input');
|
const input = await page.$('input');
|
||||||
|
Loading…
Reference in New Issue
Block a user