session
isRunningInServer
Description
Returns whether or not we are currently running in the server. This is a convenience method for doing something different in a script when running in the server as opposed to other modes
Parameters
This method does not receive any parameters.
isRunningFromCommandLine
Description
Returns whether or not we are currently running in the command line. This is a convenience method for doing something different in a script when running in the command line as opposed to other modes
Parameters
This method does not receive any parameters.
setStopScrapingOnMaxRequestAttemptsReached
Description
If this method is passed the value of true, it will cause screen-scraper to stop the current scraping session if the maximum attempts to request a file is reached.
executeScriptWithContext
Description
Executes the named script, but preserves the current context (dataRecord, scrapeableFile, etc...)
Parameters
- scriptName The name of the script to execute.
getDefaultRetryPolicy
Description
Gets the default retry policy to be used by each scrapeable file when one wasn't set for it.
Parameters
This method takes no parameters
Return Value
The default return policy, or null if there isn't one
setDefaultRetryPolicy
Description
Sets a retry policy that will affect all files in the scrape. This policy will be used by all scrapeable files that do not have a retry policy set for them. If a retry policy was manually set for them, this one will not be used.
clearVariables
void session.clearVariables ( Collection variables ) (professional and enterprise editions only)
Description
Clears the value of all session variables that match the keys in the Map. This will ignore a key of DATARECORD.
setSessionVariables
void session.setSessionVariables ( Map variables, boolean ignoreLowerCaseKeys)(professional and enterprise editions only)
Description
setDebugMode
Description
Sets the debug state for the scrape. Enabled debug mode simply outputs a warning periodically while running, to help prevent running a production scrape in debug mode.
Parameters
- debugMode True to enable debug mode, false to disable it.
getDebugMode
Description
Checks to see if this is currently set to run in debug mode. This is useful for developing scrapes, as enabling debug mode logs a warning message, so it is easier to notice a scrape with hard-coded values used for development. Also logs a warning in the web interface or log each time monitored variables are logged with the logMonitoredValues or webMessage methods are called.