shouldStopScraping

boolean session.shouldStopScraping ( )

Description

Determine if the scrape has been stopped. This can be done using the stop button in the workbench or the stop scraping button on the web interface (for enterprise users).

Parameters

This method does not receive any parameters.

Return Values

Returns true if the scrape has been requested to stop; otherwise, it returns false.

Change Log

Version Description
5.0 Added for enterprise edition.

Examples

Stop Iterator if Scrape is Stopped

 for (int i = 0; i < dataSet.getNumDataRecords(); ++i)
 {
     // check during every iteration to see if we should exit early.
      // Without this check, the iteration will continue even
     // if the stop scraping button were to be pressed.
     if ( session.shouldStopScraping() )
      {
         break;
     }

     session.setVariable( "URL", dataSet.get( i, "NEXT_PAGE_URL" ) );
     session.scrapeFile( "NEXT_PAGE" );
 }