|
10 | 10 | delay: { value: 0 },
|
11 | 11 | downloadPath: { value: "", required: false },
|
12 | 12 | downloadPathtype: { value: "str" },
|
| 13 | + fileName: { value: "", required: false }, |
| 14 | + fileNametype: { value: "str" }, |
13 | 15 | name: { value: "" },
|
14 | 16 | },
|
15 | 17 | inputs: 1,
|
|
36 | 38 | types: ["str", "msg", "flow", "global"],
|
37 | 39 | typeField: "#node-input-downloadPathtype",
|
38 | 40 | });
|
| 41 | + $("#node-input-fileName").typedInput({ |
| 42 | + type: "str", |
| 43 | + types: ["str", "msg", "flow", "global"], |
| 44 | + typeField: "#node-input-fileNametype", |
| 45 | + }); |
39 | 46 | },
|
40 | 47 | });
|
41 | 48 | </script>
|
|
69 | 76 | <input id="node-input-downloadPath"></input>
|
70 | 77 | <input type="hidden" id="node-input-downloadPathtype"></input>
|
71 | 78 | </div>
|
| 79 | + <div class="form-row"> |
| 80 | + <label for="node-input-fileName"><i class="fa fa-file-o"></i> File name</label> |
| 81 | + <input id="node-input-fileName"></input> |
| 82 | + <input type="hidden" id="node-input-fileNametype"></input> |
| 83 | + </div> |
72 | 84 | <div class="form-row">
|
73 | 85 | <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
74 | 86 | <input type="text" id="node-input-name" style="width:70%;" placeholder="Name" />
|
75 | 87 | </div>
|
| 88 | + <div class="form-tips"> |
| 89 | + <span data-i18n="[html]tip1">This node downloads a file by clicking on a specified selector. Essetially that can be done with the click node as well, but here you can specify download location and also if this node is followed by rename node with specified download path and filename, it can change the filename directly, but in order to get this to work, in the rename node the old file path needs to be set to <code>msg.old</code> and the new file path needs to be set to <code>msg.new</code>. The output of this node is a <b>msg</b> which contains <code>msg.puppeteer</code>, <code>msg.new & msg.old</code> (<b><u style="text-decoration-color: #fe6d73">only when download path and file path are specified</u></b>) and <code>msg.error</code> when an error ocurred. |
| 90 | + </div> |
76 | 91 | </script>
|
77 | 92 |
|
78 | 93 | <script type="text/x-red" data-help-name="puppeteer-page-download">
|
79 |
| - <p>Click on Chrome</p> |
| 94 | + <p>Dowload a file</p> |
80 | 95 | <h3>Inputs</h3>
|
81 | 96 | <dl class="message-properties">
|
82 | 97 | <dt>Selector<span class="property-type">string</span></dt>
|
83 | 98 | <dd>A <a href="#interface-selector" title="Selector">selector</a> to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.</dd>
|
84 | 99 | <dt>Button<span class="property-type">string</span></dt>
|
85 | 100 | <dd>Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.<"left"|"right"|"middle"> Defaults to <code>left</code>.</dd>
|
86 | 101 | <dt>Click Count<span class="property-type">number</span></dt>
|
87 |
| - <dd>Whether to run browser in <a href="https://developers.google.com/web/updates/2017/04/headless-chrome" rel="nofollow">headless mode</a>. Defaults to <code>false</code>, it will show Chrome when <code>devtools</code> option is <code>true</code>.defaults to 1. See <a href="https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail" title="UIEvent.detail" rel="nofollow">UIEvent.detail</a>.</dd> |
88 | 102 | <dt>Delay<span class="property-type">number</span></dt>
|
89 |
| - <dd>Specify custom debugging port. Pass <code>0</code> to discover a random port. Defaults to <code>0</code>.Time to wait between <code>mousedown</code> and <code>mouseup</code> in milliseconds. Defaults to 0.</dd> |
| 103 | + <dt>Download path<span class="property-type">string</span></dt> |
| 104 | + <dd>Specify custom download path. Leave the field blank for default download path. Defaults to user's default browser download path.</dd> |
| 105 | + <dt>File name<span class="property-type">string</span></dt> |
| 106 | + <dd>Specify custom file name. Leave the field blank for default file name. Please note that in order for this to work this node needs to be followed by the rename node. Defaults to default file name.</dd> |
90 | 107 | </dl>
|
91 | 108 | <h3>Details</h3>
|
92 | 109 | <p>This method fetches an element with <code>selector</code>, scrolls it into view if needed, and then uses <code>page.mouse</code> to click in the center of the element.
|
93 |
| - If there's no element matching <code>selector</code>, the method throws an error.</p> |
| 110 | + If there's no element matching <code>selector</code>, the method throws an error. The main difference between this and click node is that with this node you can specify |
| 111 | + download path and file name. But, in order the custom filename to work, this node must have download path and file name specified and be followed by a rename node where |
| 112 | + the old file path should be set to <code>msg.old</code> and the new file path should be set to <code>msg.new</code></p> |
94 | 113 | </script>
|
0 commit comments