Skip to content

Commit bae3074

Browse files
committed
adding ability to define executable path, adding useStealth mode, replacing puppeteer with puppeteer extra
1 parent e3a4874 commit bae3074

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

puppeteer/browser/close.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const puppeteer = require("puppeteer");
1+
const puppeteer = require("puppeteer-extra"); // TO-DO: Make this optional.
22

33
module.exports = function (RED) {
44
function PuppeteerBrowserClose(nodeConfig) {

puppeteer/browser/launch.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
devtools: { value: false },
1111
cookies: { value: "" },
1212
name: { value: "" },
13+
executablePath: { value: "" },
1314
},
1415
inputs: 1,
1516
outputs: 1,
@@ -52,6 +53,10 @@
5253
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
5354
<input type="text" id="node-input-name" style="width:70%;" placeholder="Name" />
5455
</div>
56+
<div class="form-row">
57+
<label for="node-input-executablePath"><i class="fa fa-tag"></i> Executable Path</label>
58+
<input type="text" id="node-input-executablePath" style="width:70%;" placeholder="Change this if you have a different chromium path..." />
59+
</div>
5560
<div class="form-tips">
5661
<span data-i18n="[html]tip1">This node launches a chromium instance and sets cookies to it if specified. The cookies should be a list of cookie objects where each one has the following properties and they should be passed in as <code>msg.payload</code>, or if directly into the input field it should be a valid JSON list:
5762
<ul>

puppeteer/browser/launch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
const puppeteer = require("puppeteer");
1+
const puppeteer = require("puppeteer-extra"); // TO-DO: Make this optional.
2+
const stealth = require('puppeteer-extra-plugin-stealth');
23

34
module.exports = function (RED) {
45
function PuppeteerBrowserLaunch(nodeConfig) {
56
RED.nodes.createNode(this, nodeConfig);
67
nodeConfig.defaultViewport = null; // Setting the node's default viewport
78
nodeConfig.ignoreHTTPSErrors = true; // Setting the node's ignoreHttpsErrors property
89
var node = this; // Referencing the current node
10+
puppeteer.use(stealth()); // TO-DO: Make optional. Use stealth.
911

1012
this.on("input", async function (msg, send, done) {
1113
try {
@@ -112,6 +114,7 @@ module.exports = function (RED) {
112114
$("#node-input-debugport").val(nodeConfig.debugport);
113115
$("#node-input-devtools").val(nodeConfig.devtools);
114116
$("#node-input-name").val(nodeConfig.name);
117+
$("#node-input-executablePath").val(nodeConfig.executablePath);
115118
}
116119
}
117120
RED.nodes.registerType("puppeteer-browser-launch", PuppeteerBrowserLaunch);

0 commit comments

Comments
 (0)