Click Item is quite a common step in the workflow when you set up a task to get the data you need. Namely, it can execute clicking action just like you click anywhere on a web page in your browser.
Besides the name of "Click Item", it also has some other names in the workflow.
- "Click URLs in the list": it shows up when this web page has items linked to other URLs.
- "Click to paginate": it is auto-generated when you set up pagination steps.
How to add a "Click Item" to the workflow?
1. Just click element(s) on the web page to generate a step in the workflow
This is commonly used in cases as below:
You just need to click the element on the page directly and then choose the option related to "Click" on the Tips panel. Here are some screenshots below as examples.
2. Add from the workflow
Sometimes, you may need to add the click actions from the workflow. Just move your mouse around the workflow and then click the icon to open the dropdown menu.
Then, you can choose "Click" to add a click action in the place you want.
When you use the auto-detect feature to generate the workflow, normally, it extracts the list data first. What if you need to click the items on the list to open their detail pages? Check our 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 settings for the "Click Item". You can double-click the step to open the settings page. The picture below shows details about click settings.
1. XPath modification
This is where to modify the XPath of the element to click. Tag and Text on the same line indicate the current element to click.
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 icon to rewrite/update the XPath. Check more details in this guide: What is XPath and how to use it in Octoparse.
2. Click Options
3. Before action is performed
You can add some wait time or condition to wait before taking the clicking action when websites require some time to load the page.
4. After page is loaded
The most frequently used one is the "Scroll down" option. If you need to add a page scroll down after the click action, you can tick this option. You can learn more about this setting here: Page scroll-down.
You can let Octoparse reload the web page based on certain conditions. Learn more about this setting here: Retry actions.
Also, you may notice there is an option called "Click items in the loop". When you need to click each item in the loop item, don't forget to tick this option.
If you have any trouble with setting up your task, you're welcome to submit a ticket to our Support team.
Artículo en español: Hacer clic en el elemento
También puede leer artículos de web scraping en el sitio web oficial