<label>The following are alternative XPath expressions, in addition to the default generated XPath, that can all locate the same element (although not entirely accurate, they may also locate other elements besides the intended one, so they are provided here for reference only). </label>
<label>Each line contains an XPath expression (you can use the pre-installed <i>XPath Helper</i> extension for debugging):</label>
<label>Tip: Hover over the smiley face to view hints, <b>double-click</b> on an action in the flowchart to test run, <b>right-click</b> on an action to see more options.</label>
<labelv-if='nowNode["parameters"]["url"]!="about:blank"'>Links (one link per line, the entire workflow will be executed as many times as there are lines of links):</label>
<labelv-else>Link (Only one link can be put here)</label>
placeholder='key=value, one pair per line' v-model='nowNode["parameters"]["cookies"]' id="pageCookies" style="font-size: 14px!important;"></textarea>
</div>
</div>
</div>
<divclass="elements"v-if="nodeType==2">
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Element is inside iframe</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Element is inside iframe</p>
<divv-if="nowNode['isInLoop']">
<!-- 如果在循环内才显示此行元素 -->
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='useLoop'></input>Use element located by xpath relative to the loop</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='useLoop'></input>Use element located by xpath relative to the loop</p>
</div>
<div>
<label>XPath: <spanstyle="font-size: 30px!important;"title="Relative XPATH writing: start with /, e.g. the loop item XPATH is /html/body/div[1], your input is /*[@id='tab-customer'], then the final addressed xpath is: /html/body/div[1]/*[@id='tab-customer']">☺</span></label>
<p><buttontype="button"data-toggle="modal"data-target="#myModal_XPath"@click="changeXPaths(nowNode['parameters']['allXPaths'])"class="btn btn-primary"style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
</div>
<label>Maximum wait time for page load after clicking (in seconds):</label>
placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].innerText = arguments[0].innerText.replace("United States","US"). This code replaces occurrences of "United States" with "US" in the text of the element. Subsequently, when extracting data, you will obtain the replaced value.' v-model='nowNode["parameters"]["beforeJS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>Execute a JavaScript script <strong>after</strong> clicking on this element: </label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.'v-model='nowNode["parameters"]["afterJS"]'></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.'v-model='nowNode["parameters"]["afterJS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["clear"]'></input>Clear other field existing values before extracting</p>
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["newLine"]'></input>This operation will generate a new row of data <spanstyle="font-size: 30px!important;"title="If unchecked, it will use the same row of data as the previous operation. If checked, it will generate a new row of data.">☺</span></p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["clear"]'></input>Clear other field existing values before extracting</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["newLine"]'></input>This operation will generate a new row of data <spanstyle="font-size: 30px!important;"title="If unchecked, it will use the same row of data as the previous operation. If checked, it will generate a new row of data.">☺</span></p>
<pv-if='!paras.parameters[paraIndex]["relative"]'><inputonkeydown="inputDelete(event)"type="checkbox"v-model='paras.parameters[paraIndex]["iframe"]'></input>Element is inside iframe</p>
<pv-if='!paras.parameters[paraIndex]["relative"]'><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='paras.parameters[paraIndex]["iframe"]'></input>Element is inside iframe</p>
<p>XPATH (Field["FieldName"] and eval("your code") can be used in any XPATHS): <spanstyle="font-size: 30px!important;"title="Relative XPATH writing: start with /, e.g. the loop item XPATH is /html/body/div[1], your input is /*[@id='tab-customer'], then the final addressed xpath is: /html/body/div[1]/*[@id='tab-customer']">☺</span></p>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"v-model='paras.parameters[paraIndex]["relativeXPath"]'placeholder="If you want to write the XPath relative to the current element in the loop, you can write as *../div[1] which matches the first div child element of the parent of the current element in the loop."></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"v-model='paras.parameters[paraIndex]["relativeXPath"]'placeholder="If you want to write the XPath relative to the current element in the loop, you can write as *../div[1] which matches the first div child element of the parent of the current element in the loop."></textarea>
<p><buttontype="button"data-toggle="modal"data-target="#myModal_XPath"@click="changeXPaths(paras.parameters[paraIndex]['allXPaths'])"class="btn btn-primary"style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].innerText = arguments[0].innerText.replace("United States","US"). This code replaces occurrences of "United States" with "US" in the text of the element. Subsequently, when extracting data, you will obtain the replaced value.' v-model='paras.parameters[paraIndex]["beforeJS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>Execute a JavaScript script <strong>after</strong> extracting data from this element: </label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.'v-model='paras.parameters[paraIndex]["afterJS"]'></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.'v-model='paras.parameters[paraIndex]["afterJS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<inputonkeydown="inputDelete(event)"class="form-control"v-model='paras.parameters[paraIndex]["JS"]'placeholder="Attribute names, such as href to represent the href attribute of the current element, that is, the link address."></input>
<inputspellcheck=false onkeydown="inputDelete(event)"class="form-control"v-model='paras.parameters[paraIndex]["JS"]'placeholder="Attribute names, such as href to represent the href attribute of the current element, that is, the link address."></input>
placeholder='The element should be represented by arguments[0]. Here is an example: return arguments[0].innerText + "US Dollar". This code extracts the innerText of the element and appends "US Dollar" to it.' v-model='paras.parameters[paraIndex]["JS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Element is inside iframe</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Element is inside iframe</p>
<divv-if="nowNode['isInLoop']">
<!-- 如果在循环内且循环内是固定文本才显示此行元素 -->
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='useLoop'></input>Use text from the loop (If unchecked, the text entered each time will be the text from the "Input Value" text box below. If checked, it will use the text set within the loop.)</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='useLoop'></input>Use text from the loop (If unchecked, the text entered each time will be the text from the "Input Value" text box below. If checked, it will use the text set within the loop.)</p>
<pv-if="useLoop">
<label>Index value (0 represents using the entire current loop text. If greater than 0, it represents the text index value separated by "~" within the current loop. For example, if the current loop text value is A~B, index value 1 represents inputting A, 2 represents inputting B, and 0 represents inputting A~B)</label>
<label>Input value (Use Field["FieldName"] to input the latest extracted/returned value of a field or custom operation. Use <enter> or <ENTER> to simulate pressing the Enter key):</label>
<label>XPath: <spanstyle="font-size: 30px!important;"title="Relative XPATH writing: start with /, e.g. the loop item XPATH is /html/body/div[1], your input is /*[@id='tab-customer'], then the final addressed xpath is: /html/body/div[1]/*[@id='tab-customer']">☺</span></label>
<p><buttontype="button"data-toggle="modal"data-target="#myModal_XPath"@click="changeXPaths(nowNode.parameters['allXPaths'])"class="btn btn-primary"style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].innerText = arguments[0].innerText.replace("United States","US"). This code replaces occurrences of "United States" with "US" in the text of the element. Subsequently, when extracting data, you will obtain the replaced value.' v-model='nowNode["parameters"]["beforeJS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>Execute JavaScript script on this element <b>after</b> entering text into it: </label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.'v-model='nowNode["parameters"]["afterJS"]'></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.'v-model='nowNode["parameters"]["afterJS"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>Code (Use Field["FieldName"] to input the lastest value of a field): </label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"v-model='nowNode["parameters"]["code"]'placeholder="Please input a JavaScript command or a system command. For example, document.body.innerText = '1' is an example of a JavaScript command, and python D:/test.py is an example of a system command. If you choose to execute a JavaScript script for the current iteration, you can represent the element of the current iteration using arguments[0]. For instance, arguments[0].style.color = 'blue' sets the color of the element in the current iteration to blue."></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"v-model='nowNode["parameters"]["code"]'placeholder="Please input a JavaScript command or a system command. For example, document.body.innerText = '1' is an example of a JavaScript command, and python D:/test.py is an example of a system command. If you choose to execute a JavaScript script for the current iteration, you can represent the element of the current iteration using arguments[0]. For instance, arguments[0].style.color = 'blue' sets the color of the element in the current iteration to blue."></textarea>
<preclass="form-control"style="background: white; margin-top: 20px; min-height: 200px; font-size: 15px!important; word-wrap: break-word; white-space: pre-wrap; border-radius: 0; border: 1px solid"disabledv-if='nowNode["parameters"]["codeMode"] == 5'>Please read the instructions first and then write the specific code in the input box above (not in this box). To execute a large amount of code, you can simply write "outside:myCode.py" and the program will read and execute the code within myCode.py under the EasySpider directory.
Be aware that statements containing exec and eval operations and XPath cannot be tested on the current page, and can only be run when they are actually called upon in a task.
This option is an advanced feature that allows direct manipulation of the running browser using Python code. You can also customize variables in the entire execution environment and perform operations such as modifying and assigning values. Here are some examples:
@ -452,7 +452,7 @@ Please note that this feature does not support assigning values to variables. In
</select>
</p>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>This operation can pause program execution, such as when a captcha box appears, and it will not continue until you manually press and hold the pause/continue shortcut key (default: key p).</label>
@ -463,35 +463,35 @@ Please note that this feature does not support assigning values to variables. In
<label>Sender email password (Be careful not to leak the task file if a password is set!):</label>
<inputonkeydown="inputDelete(event)"class="form-control"v-model='nowNode["parameters"]["emailConfig"]["password"]'placeholder="Most email servers use authorization codes, not the original password"></input>
<inputspellcheck=false onkeydown="inputDelete(event)"class="form-control"v-model='nowNode["parameters"]["emailConfig"]["password"]'placeholder="Most email servers use authorization codes, not the original password"></input>
<label>Recipient email address:</label>
<inputonkeydown="inputDelete(event)"class="form-control"v-model='nowNode["parameters"]["emailConfig"]["to"]'placeholder="Separate multiple recipients with commas"></input>
<inputspellcheck=false onkeydown="inputDelete(event)"class="form-control"v-model='nowNode["parameters"]["emailConfig"]["to"]'placeholder="Separate multiple recipients with commas"></input>
<label>Email subject:</label>
<inputonkeydown="inputDelete(event)"class="form-control"v-model='nowNode["parameters"]["emailConfig"]["subject"]'placeholder="Write the email subject here"></input>
<inputspellcheck=false onkeydown="inputDelete(event)"class="form-control"v-model='nowNode["parameters"]["emailConfig"]["subject"]'placeholder="Write the email subject here"></input>
<label>Email content:</label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"v-model='nowNode["parameters"]["emailConfig"]["content"]'placeholder="Write the email content here"></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"v-model='nowNode["parameters"]["emailConfig"]["content"]'placeholder="Write the email content here"></textarea>
</div>
</div>
<divclass="elements"v-if="nodeType==6">
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Element is inside iframe</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Element is inside iframe</p>
<divv-if="nowNode['isInLoop']">
<!-- Display this element only if inside a loop and the loop contains fixed text -->
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='useLoop'></input>Use index value from within the loop (if unchecked, the setting will be the value of the "Set Value" text box below. If checked, it will use the index value set within the loop's dropdown box.)</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='useLoop'></input>Use index value from within the loop (if unchecked, the setting will be the value of the "Set Value" text box below. If checked, it will use the index value set within the loop's dropdown box.)</p>
<pv-if="useLoop">
<label>Relative index value of the loop value (0 represents using the entire current loop's text. If greater than 0, it represents the value of the text separated by "~" within the current loop. For example, if the current loop's text value is 2~3 and you enter 2 here, it means taking the second item of the text, which is value 3, indicating setting the dropdown box to the third item.)</label>
<p><buttontype="button"data-toggle="modal"data-target="#myModal_XPath"@click="changeXPaths(nowNode['parameters']['allXPaths'])"class="btn btn-primary"style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
<divv-if="!useLoop">
<p>Option switch Mode</p>
@ -502,19 +502,19 @@ Please note that this feature does not support assigning values to variables. In
<option:value =3>Switch options by option text</option>
</select>
<p>Set value (not applicable for "Switch to the next option" mode)</p>
<p><buttontype="button"data-toggle="modal"data-target="#myModal_XPath"@click="changeXPaths(nowNode['parameters']['allXPaths'])"class="btn btn-primary"style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
</div>
@ -522,7 +522,7 @@ Please note that this feature does not support assigning values to variables. In
</div>
<divclass="elements"v-if="nodeType==8">
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Operation is in iframe</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Operation is in iframe</p>
@ -537,20 +537,20 @@ Please note that this feature does not support assigning values to variables. In
</select>
<divv-if='parseInt(loopType) < 2'>
<label>XPath: <spanstyle="font-size: 30px!important;"title="Relative XPATH writing: start with /, e.g. the loop item XPATH is /html/body/div[1], your input is /*[@id='tab-customer'], then the final addressed xpath is: /html/body/div[1]/*[@id='tab-customer']">☺</span></label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="2"v-model='nowNode["parameters"]["xpath"]'placeholder="You cannot use expressions like @href or text() within loops in XPath. You can only locate elements, but cannot fetch attribute values. Declaratives like @href and text() are only supported in data extraction operations. Moreover, it is not recommended to use them. Instead, it's suggested choosing the node type and type of the content to collect directly within data extraction operations."></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="2"v-model='nowNode["parameters"]["xpath"]'placeholder="You cannot use expressions like @href or text() within loops in XPath. You can only locate elements, but cannot fetch attribute values. Declaratives like @href and text() are only supported in data extraction operations. Moreover, it is not recommended to use them. Instead, it's suggested choosing the node type and type of the content to collect directly within data extraction operations."></textarea>
<p><buttontype="button"data-toggle="modal"data-target="#myModal_XPath"@click="changeXPaths(nowNode.parameters['allXPaths'])"class="btn btn-primary"style="margin-top: 10px">(Testing feature) Click here to view other possible XPath expressions</button></p>
<label>Content List (Use Field["FieldName"] to input the lastest value of a field):</label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="3"placeholder="One text/URL per line. Each line is A text/URL, and the text is divided by ~, that is, if the value of A line is A~B, the index value can be set to 1 for A, 2 for B, and 0 for A~B in the input text operation."v-model='nowNode["parameters"]["textList"]'></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="3"placeholder="One text/URL per line. Each line is A text/URL, and the text is divided by ~, that is, if the value of A line is A~B, the index value can be set to 1 for A, 2 for B, and 0 for A~B in the input text operation."v-model='nowNode["parameters"]["textList"]'></textarea>
</div>
<divv-else-if='parseInt(loopType) < 8'>
<label>Code (Use Field["FieldName"] to input the lastest value of a field):</label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="3"v-model='nowNode["parameters"]["code"]'placeholder="Continue the loop if the command return value is greater than 0 or evaluates to true; otherwise, stop the loop. For example, return document.body.scrollWidth > 1000 is an example of a JavaScript command return value, and python D:/test.py is an example of a system command return value."></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="3"v-model='nowNode["parameters"]["code"]'placeholder="Continue the loop if the command return value is greater than 0 or evaluates to true; otherwise, stop the loop. For example, return document.body.scrollWidth > 1000 is an example of a JavaScript command return value, and python D:/test.py is an example of a system command return value."></textarea>
<preclass="form-control"style="background: white; margin-top: 20px; min-height: 220px; font-size: 15px!important; word-wrap: break-word; white-space: pre-wrap; border-radius: 0; border: 1px solid"disabledv-if='parseInt(loopType) == 7'>Please read the instructions first and then write the specific code in the input box above (not in this box). To execute a large amount of code, you can simply write "outside:myCode.py" and the program will read and execute the code within myCode.py under the EasySpider directory.
Loop based on the expression value of Python code. Here are some examples:
1. Return relevant values of the current browser object. Use `self.browser` to refer to the current browser being operated. You can directly use Selenium's API to perform operations, such as `self.browser.find_element(By.CSS_SELECTOR, "body").text=="123"`, which checks whether the current page contains the text "123".
@ -560,14 +560,14 @@ Loop based on the expression value of Python code. Here are some examples:
If the expression returns a value greater than 0 or evaluates to True, the loop continues; otherwise, it stops.
</pre>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>Maximum number of loop iterations (0 represents an infinite loop until no more elements are found or no changes in page content are detected):</label>
<label>Exit the loop when the content of the following elements on the page does not change (effective when the count is 0. If it is a multi-layer nested iframe, it is recommended to write an XPath for an element that only exists within the iframe page you want to extract, such as /html/body/div[@class='LeftSide_menu']):</label>
placeholder='Exit the loop directly if the command return value is less than or equal to 0 or evaluates to false. Example: return document.body.scrollWidth > 1000 or python D:/test.py, which are examples of JavaScript command and system command return values.' v-model='nowNode["parameters"]["breakCode"]'></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
@ -607,7 +607,7 @@ If the expression returns a value greater than 0 or evaluates to True, the loop
<divclass="elements"v-if="nodeType==10">
<label>The conditions are evaluated from left to right, which means if the condition in the leftmost branch is satisfied, the operations within that branch are executed. Otherwise, the condition in the next branch from left to right is evaluated, and so on. Clicking on a branch while designing tasks allows for <b>dynamic debugging</b> in the browser to verify if the branch satisfies the condition (not applicable to system commands and Python Eval operations). </label>
<p><inputonkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Operation is in iframe</p>
<p><inputspellcheck=false onkeydown="inputDelete(event)"type="checkbox"v-model='nowNode["parameters"]["iframe"]'></input>Operation is in iframe</p>
@ -623,11 +623,11 @@ If the expression returns a value greater than 0 or evaluates to True, the loop
<divv-if='TClass > 0 && TClass < 5'>
<label>Text/Element XPath to Include: <spanstyle="font-size: 30px!important;"title="Relative XPath syntax: starts with /, e.g., if the XPath of the loop item is /html/body/div[1], and you input /*[@id='tab-customer'], the final XPath will be: /html/body/div[1]/*[@id='tab-customer']">☺</span></label>
<textareaonkeydown="inputDelete(event)"requiredplaceholder="If the current loop contains elements, input the xpath of the relative element (such as '/div[2]/div[1]/img', if written in relative path, it should be written as '/*//img', which means checking whether there exists an 'img' tag among all the descendant elements of the current loop item.)."class="form-control"rows="3"v-model='nowNode["parameters"]["value"]'></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"requiredplaceholder="If the current loop contains elements, input the xpath of the relative element (such as '/div[2]/div[1]/img', if written in relative path, it should be written as '/*//img', which means checking whether there exists an 'img' tag among all the descendant elements of the current loop item.)."class="form-control"rows="3"v-model='nowNode["parameters"]["value"]'></textarea>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="3"v-model='nowNode["parameters"]["code"]'placeholder="If the return value is greater than 0 or true, the operations within this branch will be executed; otherwise, they will not be executed. For example: return document.body.scrollWidth > 1000 or python D:/test.py, representing examples of JS command and system command return values."></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="3"v-model='nowNode["parameters"]["code"]'placeholder="If the return value is greater than 0 or true, the operations within this branch will be executed; otherwise, they will not be executed. For example: return document.body.scrollWidth > 1000 or python D:/test.py, representing examples of JS command and system command return values."></textarea>
<preclass="form-control"style="background: white; margin-top: 20px; min-height: 200px; font-size: 15px!important; word-wrap: break-word!important; white-space: pre-wrap; border-radius: 0; border: 1px solid"disabledv-if='TClass == 8'>Please read the instructions first and then write the specific code in the input box above (not in this box). To execute a large amount of code, you can simply write "outside:myCode.py" and the program will read and execute the code within myCode.py under the EasySpider directory.
Use the expression value of Python code to determine whether a condition is satisfied. Here are some examples:
1. Return relevant values of the current browser object. Use `self.browser` to refer to the current browser being operated. You can directly use Selenium's API to perform operations, such as `self.browser.find_element(By.CSS_SELECTOR, "body").text=="123"`, which checks whether the current page contains the text "123".
@ -637,26 +637,26 @@ Use the expression value of Python code to determine whether a condition is sati
If the expression returns a value greater than 0 or evaluates to True, the operations within this branch will be executed; otherwise, they will be skipped.
</pre>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<label>Code/Script Content (<ahref="https://github.com/NaiboWang/EasySpider/wiki/Example-of-JavaScript-instruction-for-the-current-iteration-in-a-conditional-statement"target="_blank">Click here</a> for more examples): </label>
<textareaonkeydown="inputDelete(event)"class="form-control"rows="3"v-model='nowNode["parameters"]["code"]'placeholder="Enter the JS command for the current loop item. The loop item is represented by arguments[0]. If the return value is greater than 0 or true, the operations within this branch will be executed; otherwise, they will not be executed. For example: return arguments[0].innerText.length >= 5, which checks if the text length of the current loop item is greater than 5. Note that this is used in combination with element-related loop types (e.g., non-fixed element lists)."></textarea>
<textareaspellcheck=false onkeydown="inputDelete(event)"class="form-control"rows="3"v-model='nowNode["parameters"]["code"]'placeholder="Enter the JS command for the current loop item. The loop item is represented by arguments[0]. If the return value is greater than 0 or true, the operations within this branch will be executed; otherwise, they will not be executed. For example: return arguments[0].innerText.length >= 5, which checks if the text length of the current loop item is greater than 5. Note that this is used in combination with element-related loop types (e.g., non-fixed element lists)."></textarea>
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
<inputonkeydown="inputDelete(event)"requiredname="serviceName"value="New Web Crawler Task"id="serviceName"class="form-control"></input>
<inputspellcheck=false onkeydown="inputDelete(event)"requiredname="serviceName"value="New Web Crawler Task"id="serviceName"class="form-control"></input>
<label>Export Data Format (Excel/CSV/TXT/Database):</label>
<selectid="outputFormat"class="form-control">
<optionvalue ="xlsx">XLSX (EXCEL, note that a single Excel cell can save up to 32767 characters)</option>
@ -697,7 +697,7 @@ If the expression returns a value greater than 0 or evaluates to True, the opera
<optionvalue ="mysql">MySQL Database</option>
</select>
<label>Export File Name/Database Table Name (Can use ../ to represent relative path to change the file save location,the keyword "current_time" will be replaced with the timestamp when the task is executed):</label>
<optionvalue="1">Append (If the file exists, append to it)</option>
@ -709,7 +709,7 @@ If the expression returns a value greater than 0 or evaluates to True, the opera
<!-- <option value=1>Yes (Only support on Windows x64 platform)</option>-->
<!-- </select>-->
<label>To modify the input parameters of each operation during execution, read the following Excel (.xlsx) file. Please click the "Read Input Parameters from Excel File" button when calling the task to view the file format:</label>
<inputonkeydown="inputDelete(event)"id="inputExcel"name="inputExcel"class="form-control"placeholder="If left empty, input parameters will not be read from Excel. The file path is relative to the EasySpider folder, e.g., inputs/task1.xlsx"></input>
<inputspellcheck=false onkeydown="inputDelete(event)"id="inputExcel"name="inputExcel"class="form-control"placeholder="If left empty, input parameters will not be read from Excel. The file path is relative to the EasySpider folder, e.g., inputs/task1.xlsx"></input>
@ -721,23 +721,23 @@ If the expression returns a value greater than 0 or evaluates to True, the opera
<optionvalue =1>Yes</option>
</select>
<label>Save Data Every N Rows (Specify N below, the larger the value, the faster the scraping speed, but there is a risk of data loss if unexpectedly exited):</label>
<label>Do you want to resume execution from the last saved position when unexpectedly exiting and restarting the task (The record interval of the number of collected items is the value set above)?</label>
<optionvalue="1">Yes (Requires running the same task ID and the same file name, please execute from the command line and specify the ID)</option>
</select>
<label>Wait time for the browser to close after the task is executed (in seconds), the temporary user data directory will be automatically deleted after the browser is closed:</label>