forked from drashland/sinco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.ts
51 lines (49 loc) · 1.25 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { Client } from "./src/client.ts";
import { BuildOptions, Cookie, ScreenshotOptions } from "./src/interfaces.ts";
//import type { Browsers } from "./src/types.ts";
import { getChromeArgs } from "./src/utility.ts";
import { Page } from "./src/page.ts";
export type { BuildOptions, Cookie, ScreenshotOptions };
export async function buildFor(
browser: "chrome",
options: BuildOptions = {
hostname: "localhost",
debuggerPort: 9292,
binaryPath: undefined,
},
): Promise<{
browser: Client;
page: Page;
}> {
if (!options.debuggerPort) options.debuggerPort = 9292;
if (!options.hostname) options.hostname = "localhost";
//if (browser === "chrome") {
const args = getChromeArgs(options.debuggerPort, options.binaryPath);
return await Client.create(
args,
{
hostname: options.hostname,
port: options.debuggerPort,
},
browser,
undefined,
);
//}
// else {
// const tmpDirName = Deno.makeTempDirSync();
// const args = getFirefoxArgs(
// tmpDirName,
// options.debuggerPort,
// options.binaryPath,
// );
// return await Client.create(
// args,
// {
// hostname: options.hostname,
// port: options.debuggerPort,
// },
// browser,
// tmpDirName,
// );
//}
}