forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirefox-driver.js
More file actions
executable file
·45 lines (35 loc) · 1.24 KB
/
firefox-driver.js
File metadata and controls
executable file
·45 lines (35 loc) · 1.24 KB
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
"use strict";
const webdriver = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
const By = webdriver.By;
const until = webdriver.until;
const Key = webdriver.Key;
const shouldStart = process.argv.indexOf("--start") > 0;
const useWebSocket = process.argv.indexOf("--websocket") > 0;
function firefoxBinary() {
var binary = new firefox.Binary();
binary.addArguments('--start-debugger-server', '6080')
return binary;
}
function firefoxProfile() {
var profile = new firefox.Profile();
profile.setPreference('devtools.debugger.remote-port', 6080);
profile.setPreference("devtools.debugger.remote-enabled", true);
profile.setPreference("devtools.chrome.enabled", true);
profile.setPreference("devtools.debugger.prompt-connection", false);
profile.setPreference("devtools.debugger.remote-use-websocket", useWebSocket);
return profile;
}
function start() {
let options = new firefox.Options();
options.setProfile(firefoxProfile())
options.setBinary(firefoxBinary());
const driver = new firefox.Driver(options);
return driver;
}
if (shouldStart) {
const driver = start();
driver.get("http://localhost:8000/todomvc");
setInterval(() => {}, 100);
}
module.exports = { start, By, Key, until }