getVariable

Object runnableScrapingSession.getVariable ( String variableName ) (professional and enterprise editions only)

Description

Retrieve the the value of a session variable. This method should be called after scrape method has returned.

Parameters

  • variableName Name of the variable, as a string.

Return Values

Returns the value of the session variable: object, boolean, int, string, etc. If the variable doesn't exists it returns null.

Change Log

Version Description
4.5 Available for professional and enterprise editions.

Examples

Write Variable to Log

 runnableScrapingSession = new com.screenscraper.scraper.RunnableScrapingSession( "My Session" );

 // Ensure scrape will be run before the script continues
 runnableScrapingSession.setDoLazyScrape( false );

 // Start the scrape
 runnableScrapingSession.scrape();

 // Outputs the value of the variable FOO to the log.
 session.log( "FOO: " + runnableScrapingSession.getVariable( "FOO" ) );

See Also

  • setVariable() [RunnableScrapingSession] - Sets a variable for the scraping session