You are browsing a tutorial guide for the latest Octoparse version. If you are running an older version of Octoparse, we strongly recommend you upgrade because it is faster, easier and more robust! Download and upgrade here if you haven't already done so!
A Click is one of the most commonly used steps in the workflow when you set up a task to get the data you need. As its name implies, it can simulate a clicking action just like how you'd click anywhere on a web page in your browser.
Besides Click Item, it also has some other names in the workflow.
Click URLs in the list: This shows up when this web page has items linked to other URLs
Click to paginate: This is auto-generated when you set up pagination steps
How to add a Click Item to the workflow?
1. A "Click Item" can be generated simply by clicking on any page element on the webpage.
This is commonly used in the cases below:
Click on any element on the page - choose any of the options that indicate "click" on the Tips panel. Below are some screenshots as examples.
2. Add from the workflow
Alternatively, you can also go to the workflow, click on the add step button - select Click to add an action
Then you need to input the XPath of the element we need to click in the settings of this Click Item action so that it knows which button to click on.
Click on the Click Item
Input the XPath directly if you know the XPath of the element
Click Apply to save
TIP: refer to this tutorial on how to write an Xpath: What is XPath and how to use it in Octoparse?
If you don't know how to write the XPath, you can
Click on the XPath generation button
Choose the element you want to click from the web page and Octoparse will generate an XPath
3. Auto-detect
When you use the auto-detect feature to generate the workflow, it extracts the list data first. What if you need to click the items on the list to open their detailed pages? Check out this tutorial for more details: Click each link in a list and scrape data from new pages
Action settings for Click Item
Sometimes, you may need to adjust the settings for the "Click Item". You can click on the Click Item to open the settings.
1. XPath modification
This is where you can modify the XPath of the element to click. Tag and Text indicate the current element to click on.
Sometimes, the Click Item doesn't work to execute click actions. It is possible that the XPath is no longer valid because the website has updated its page layout. In this case, you may need to click the XPath generation button to update the XPath or rewrite one on your own.
2. Click Options
You can add some wait time or condition to wait before taking the clicking action when websites require some time to load the page.
Open in a new tab can open the page in a new tab as a browser does.
Load with AJAXis for handling the AJAX loading page.
Scroll down the page after it is loaded to simulate the page scrolling after clicking open the page.
3. Retry
You can let Octoparse reload the web page based on certain conditions. Learn more about this setting here: retry actions.
4. Relative and Absolute XPath
If you check the settings of a Click Item which is inside a Loop Item, you may notice that there is an option called Relative XPath and Absolute XPath. The two Xpath options only show when the Click Item is inside a Loop. If you need to click on each item in the loop item, don't forget to tick this Relative XPath. Check the difference between the two XPath options here.