The "Open in a new tab" is the same as the "Open link in new tab" function in a browser.
It is one of the most frequently used features while building a crawler. Without this feature, we can't click through all the pages to extract the data. In this tutorial, we are going to learn how and when to use this feature to get to the page that has the data we need.
Where is the "Open in a new tab"
The "Open in a new tab" feature is in the "Click Item" action. You can hover on a Click Item and click the gear icon to enter the action settings panel.
On the settings panel, you can find the "Open in a new tab" feature under the "Click Options" session. Ticking the box in front of it will activate the feature.
When is the right time to use this feature?
Octoparse will open a link in a new tab if the "Open in a new tab" feature is ticked, so the new page won't cover the previous page and Octoparse can get back to the previous page to open other links. You can use this feature when you don't want the new page to cover the previous one. Just think about how would you use the "Open link in new tab" when browsing a website. We've listed two common cases using the feature below:
1. When you need to loop click through a list of items
For example, when you need to click through a list of product links to extract data on the product detail pages from an e-commerce website, you need to check the "Open in a new tab" option. If you don't check it, Octoparse won't be able to return to the listing page and enter other products' detail pages.
2. When you need to loop input a list of keywords to search for the data
For example, when you need to input keywords to search for some items on an e-commerce website, the "Open in a new tab" option must be checked for the Click Item that clicks the search button. Otherwise, Octoparse won't be able to enter a new keyword.
1. Octoparse usually automatically selects the "Open in a new tab" when generating Click Items. But in case you encounter the following issue, you may need to check if this option is ticked:
2. Note that you should not use the "Open in a new tab" feature when the page loads the information with AJAX since pages with AJAX cannot open a new tab but directly update information on the current page.
How to identify an AJAX website? Please refer to this tutorial Handling AJAX.
If you have questions, you are welcome to submit a request here. Our support team will get back to you later.
Artículo en español: Abrir página en una nueva pestaña
También puedes leer artículos de web scraping en sitio web oficial