Exporting scraping sessions that use session.executeScript

Many have probably noticed that when a scraping session is exported from screen-scraper all of the scripts invoked from within that scraping session get exported along with it.  All of the scripts, that is, except those that get invoked via the session.executeScript method.  The exporter isn’t quite smart enough to actually parse the text of scripts to look for scripts that should be exported because they’re invoked via that method.

Fortunately, there’s an easy workaround.  For scripts that get invoked via session.executeScript simply associate them with the scraping session itself, but then disable them.  That is, on the “General” tab for a scraping session add the scripts via the “Add Script” button, then under the “Enabled?” column in the scripts table un-check the box.  This way the scripts won’t get executed at the beginning of the scraping session, but they will get exported.

Leave a Comment