Added support for nightmare-inline-download to nightmare.js

This commit is contained in:
Nishant Kyal
2017-08-28 14:17:24 +05:30
parent b84df2925f
commit b921423137
2 changed files with 17 additions and 0 deletions
+11
View File
@@ -30,6 +30,8 @@ declare class Nightmare {
uncheck(seletor: string): Nightmare;
select(seletor: string, option: string): Nightmare;
upload(selector: string, path: string): Nightmare;
download(path:string): Nightmare;
download(action: Nightmare.IDownloadActions): Nightmare;
scrollTo(top: number, left: number): Nightmare;
viewport(width: number, height: number): Nightmare;
inject(type: string, file: string): Nightmare;
@@ -134,6 +136,11 @@ declare namespace Nightmare {
cookiesFile?: string;
phantomPath?: string;
show?: boolean;
paths?: {
downloads?:string;
};
maxDownloadRequestWait?:number;
ignoreDownloads?:boolean;
}
export interface IRequest {
@@ -171,6 +178,10 @@ declare namespace Nightmare {
line: number;
function?: string;
}
export enum IDownloadActions {
cancel = "cancel",
continue = "continue"
}
export class Cookies {
get(): [Nightmare.ICookie];
get(name: string): Nightmare.ICookie;
+6
View File
@@ -343,3 +343,9 @@ new Nightmare()
new Nightmare()
.goto('https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select')
.select('select[name=select]', 'value3');
new Nightmare()
.goto('https://github.com/segmentio/nightmare')
.click('a[href="/segmentio/nightmare/archive/master.zip"]')
.download('/some/other/path/master.zip');
.run(done);