βοΈWorkflow
Last updated
Last updated
Workflow allows multiple scripts to be executed in a linked manner, or in a disordered order. It is very useful when multiple scripts have a causal relationship or we want to execute a few of these scripts at random. Next, we will use the Douban script we recorded in the previous chapter to learn it.
Find the Douban script we imported earlier, click the More menu, and then click Edit:
In the pop-up box process, click to expand and click the "2010 年代" button. You can see that we can add some effects to this operation. First, we click to add a browsing step, enter 5 in the browsing seconds input box after the word slides, and then click Add:
This step means that after clicking on the 2010s, wait for 5 seconds for the web page to complete the classification work and display the latest list. Then we click to bind the output variable:
This step means that after the page clicks on the 2010s, we need to extract some web page text content we need on the current page for use by other scripts. In this example, we need to get the name of the movie. We fill in the variable name as the movie name in the pop-up box, and we will fill in the selector in the second step.
In this step of editing the script process, if you need to output variables (that is, the previous step) and set it as a list batch operation, you need to understand the selector. Let's go back to Google Chrome and find the first item in the list of selected movies: Interstellar. Right-click on the title of Interstellar and Inspect to come to the developer tools we are familiar with:
Place the mouse on the default selected HTML content (on the right in the above picture) to see if the desired content on the left page, i.e. the four words "Interstellar", are highlighted. If not, you can click the Select Element button in the developer tools ( the first button on the left of Elements ), and then click Interstellar to select the HTML element by default.
Next, right-click on the selected HTML element and select Copy -> Copy selector.
Then we go back to BrowTo app, paste the selector in the selector input box, and then add it. You can see that we have added two operations to the current click:
Finally confirm and update the editing process.
We click the Workflow tab, click Add Workflow on the right, fill in Workflow Test in the name in the pop-up window, and then click Add Script:
In the script adding pop-up window, first select the Douban query test script, then select the Google search script (the selection order determines the subsequent input variable references. In the sequential execution mode, the later selected script can reference the previously selected script):
Then go back and hover your mouse over the Google search script. You can see a pop-up window with optional input configuration:
We click Modify Input Configuration and modify the default search content in the pop-up window. We first enter the @ symbol to reference the output content of the previous script (i.e. Douban script), and then add online watch:
Finally, click Update, set the bound window and concurrency number, keep the sequential execution by default, and click Add.
Finally, click on the script run shortcut and you can see that the two scripts are run in sequence in the specified window, and finally search for the results of watching Interstellar Online watch in Google.