{"id":37029089,"url":"https://github.com/springernature/truffler","last_synced_at":"2026-01-14T03:29:05.518Z","repository":{"id":57380262,"uuid":"20329783","full_name":"springernature/truffler","owner":"springernature","description":"Access web pages programmatically with PhantomJS, for running tests or scraping information","archived":true,"fork":false,"pushed_at":"2020-04-17T14:47:35.000Z","size":113,"stargazers_count":24,"open_issues_count":1,"forks_count":5,"subscribers_count":296,"default_branch":"master","last_synced_at":"2025-11-02T10:04:20.116Z","etag":null,"topics":["pa11y","phantomjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/springernature.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-30T13:22:34.000Z","updated_at":"2023-01-28T05:54:19.000Z","dependencies_parsed_at":"2022-09-05T13:50:42.365Z","dependency_job_id":null,"html_url":"https://github.com/springernature/truffler","commit_stats":null,"previous_names":["rowanmanning/truffler"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/springernature/truffler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springernature%2Ftruffler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springernature%2Ftruffler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springernature%2Ftruffler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springernature%2Ftruffler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/springernature","download_url":"https://codeload.github.com/springernature/truffler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springernature%2Ftruffler/sbom","scorecard":{"id":842470,"data":{"date":"2025-08-11","repo":{"name":"github.com/springernature/truffler","commit":"397be10035c1c870dc0b9cf72b73212bf8939bea"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":4,"reason":"Found 9/21 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T20:47:19.758Z","repository_id":57380262,"created_at":"2025-08-23T20:47:19.758Z","updated_at":"2025-08-23T20:47:19.758Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pa11y","phantomjs"],"created_at":"2026-01-14T03:29:04.767Z","updated_at":"2026-01-14T03:29:05.499Z","avatar_url":"https://github.com/springernature.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nTruffler\n========\n\nAccess web pages programmatically with [PhantomJS][phantom], for running tests or scraping information.\n\n[![NPM version][shield-npm]][info-npm]\n[![Node.js version support][shield-node]][info-node]\n[![Build status][shield-build]][info-build]\n[![Dependencies][shield-dependencies]][info-dependencies]\n[![MIT licensed][shield-license]][info-license]\n\n```js\nvar truffler = require('truffler');\n\nvar test = truffler(function(browser, page, done) {\n    // the test function to run in PhantomJS\n    done();\n});\n\ntest.run('http://www.nature.com/', function(error, results) {\n    console.log(results);\n});\n```\n\n\nTable Of Contents\n-----------------\n\n- [Install](#install)\n- [Usage](#usage)\n- [Options](#options)\n- [Examples](#examples)\n- [Contributing](#contributing)\n- [Support and Migration](#support-and-migration)\n- [License](#license)\n\n\nInstall\n-------\n\nInstall Truffler with [npm][npm]:\n\n```sh\nnpm install truffler\n```\n\n\nUsage\n-----\n\nRequire in Truffler:\n\n```js\nvar truffler = require('truffler');\n```\n\nCreate a test runner by initialising Truffler with a test function. This test function has access to a PhantomJS [browser][phantom-browser] and [page][phantom-page] instance, as well as a copy of all the passed in options. The test function must accept a third argument which is a callback:\n\n```js\nvar test = truffler(function(browser, page, options, done) {\n    // ... perform testing here ...\n    done(error, results);\n});\n```\n\nWithin this function, you have access to all of the behaviour in PhantomJS.\n\nYou can also instantiate Truffler with some [default options](#options) if you wish. This allows you to change the way PhantomJS and your page is loaded:\n\n```js\nvar test = truffler({\n    // ... options go here ...\n}, function(browser, page, options, done) {\n    // ... perform testing here ...\n});\n```\n\nThe `test.run` function can then be used to run your test function against a URL:\n\n```js\ntest.run('http://www.nature.com/', function(error, results) {\n    // ...\n});\n```\n\nThe `error` and `results` parameters contain errors and results from the PhantomJS run against your page. The results can be any object you like. Here's an example test function which returns the page title if it has one, or errors if not.\n\n```js\nvar test = truffler(function(browser, page, options, done) {\n    page.evaluate(\n        function() {\n            return document.title;\n        },\n        function(error, title) {\n            if (!title) {\n                return done(new Error('The page has no title!'));\n            }\n            done(null, title);\n        }\n    );\n});\n\ntest.run('http://www.nature.com/', function(error, title) {\n    // ... do something with the error and title ...\n});\n```\n\n\nOptions\n-------\n\nTruffler has lots of options you can use to change the way PhantomJS runs, or the way your page is loaded. Options can be set either on the Truffler instance when it's created or the individual test runs. This allows you to set some defaults which can be overridden per-test:\n\n```js\n// Set the default Foo header to \"bar\"\nvar test = truffler({\n    page: {\n        headers: {\n            Foo: 'bar'\n        }\n    }\n}, function() { /* ... */ });\n\n// Run a test with the Foo header set to \"bar\"\ntest.run('http://www.nature.com/', function(error, title) { /* ... */});\n\n// Run a test with the Foo header overridden\ntest.run('http://www.nature.com/', {\n    page: {\n        headers: {\n            Foo: 'hello'\n        }\n    }\n}, function(error, title) { /* ... */});\n```\n\nBelow is a reference of all the options that are available:\n\n### `log` (object)\n\nAn object which implments the methods `debug`, `error`, and `info` which will be used to report errors and test information.\n\n```js\ntruffler({\n    log: {\n        debug: console.log.bind(console),\n        error: console.error.bind(console),\n        info: console.info.bind(console)\n    }\n});\n```\n\nEach of these defaults to an empty function.\n\n### `page.headers` (object)\n\nA key-value map of request headers to send when testing a web page.\n\n```js\ntruffler({\n    page: {\n        headers: {\n            Cookie: 'foo=bar'\n        }\n    }\n});\n```\n\nDefaults to an empty object.\n\n### `page.settings` (object)\n\nA key-value map of settings to add to the PhantomJS page. For a full list of available settings, see the [PhantomJS page settings documentation][phantom-page-settings].\n\n```js\ntruffler({\n    page: {\n        settings: {\n            loadImages: false,\n            userName: 'nature',\n            password: 'say the magic word'\n        }\n    }\n});\n```\n\nDefaults to:\n\n```js\n{\n    resourceTimeout: 30000,\n    userAgent: 'truffler/\u003cversion\u003e'\n}\n```\n\n### `page.viewport` (object)\n\nThe viewport width and height in pixels. The `viewport` object must have both `width` and `height` properties.\n\n```js\ntruffler({\n    page: {\n        viewport: {\n            width: 320,\n            height: 480\n        }\n    }\n});\n```\n\nDefaults to:\n\n```js\n{\n    width: 1024,\n    height: 768\n}\n```\n\n### `phantom` (object)\n\nA key-value map of settings to initialise PhantomJS with. This is passed directly into the `phantom` module – [documentation can be found here][phantom-node-options]. You can pass PhantomJS command-line parameters in the `phantom.parameters` option as key-value pairs.\n\n```js\ntruffler({\n    phantom: {\n        path: 'PATH_TO_PHANTOMJS_EXE',\n        port: 1234,\n        parameters: {\n            'ignore-ssl-errors': 'true'\n        }\n    }\n});\n```\n\nDefaults to an empty object. If `phantom.port` is not specified, a random available port will be used.\n\n### `timeout` (number)\n\nThe maximum time (in milliseconds) that Truffler should run for. This timeout can sometimes be exceeded, if a long-running task has started within PhantomJS itself. This is rare, but you shouldn't rely on exact timing.\n\nIf the timeout is exceeded, the test function will callback with an error and no results.\n\n```js\ntruffler({\n    timeout: 1000\n});\n```\n\nDefaults to `30000` (30 seconds).\n\n\nExamples\n--------\n\n### Basic Example\n\nRun Truffler on a URL and output the page title:\n\n```\nnode example/basic\n```\n\n### Multiple Example\n\nUse [async][async] to run Truffler on multiple URLs in series, and output the page titles:\n\n```\nnode example/multiple\n```\n\n\nContributing\n------------\n\nTo contribute to Truffler, clone this repo locally and commit your code on a separate branch.\n\nPlease write unit tests for your code, and check that everything works by running the following before opening a pull-request:\n\n```sh\nmake ci\n```\n\n\nSupport and Migration\n---------------------\n\nTruffler major versions are normally supported for 6 months after their last minor release. This means that patch-level changes will be added and bugs will be fixed. The table below outlines the end-of-support dates for major versions, and the last minor release for that version.\n\nWe also maintain a [migration guide](MIGRATION.md) to help you migrate.\n\n| :grey_question: | Major Version | Last Minor Release | Node.js Versions | Support End Date |\n| :-------------- | :------------ | :----------------- | :--------------- | :--------------- |\n| :heart:         | 3             | N/A                | 4+               | N/A              |\n| :hourglass:     | 2             | 2.3                | 0.12+            | 2017-04-23       |\n| :skull:         | 1             | 1.0                | 0.10–4           | 2016-10-16       |\n\nIf you're opening issues related to these, please mention the version that the issue relates to.\n\n\nLicense\n-------\n\nTruffler is licensed under the [MIT][info-license] license.  \nCopyright \u0026copy; 2015, Springer Nature\n\n\n\n[1.x]: https://github.com/springernature/truffler/tree/1.x\n[async]: https://github.com/caolan/async\n[npm]: https://npmjs.org/\n[phantom]: http://phantomjs.org/\n[phantom-browser]: http://phantomjs.org/api/phantom/\n[phantom-node-options]: https://github.com/sgentle/phantomjs-node#functionality-details\n[phantom-page]: http://phantomjs.org/api/webpage/\n[phantom-page-settings]: http://phantomjs.org/api/webpage/property/settings.html\n\n[info-dependencies]: https://gemnasium.com/springernature/truffler\n[info-license]: LICENSE\n[info-node]: package.json\n[info-npm]: https://www.npmjs.com/package/truffler\n[info-build]: https://travis-ci.org/springernature/truffler\n[shield-dependencies]: https://img.shields.io/gemnasium/springernature/truffler.svg\n[shield-license]: https://img.shields.io/badge/license-MIT-blue.svg\n[shield-node]: https://img.shields.io/badge/node.js%20support-4–6-brightgreen.svg\n[shield-npm]: https://img.shields.io/npm/v/truffler.svg\n[shield-build]: https://img.shields.io/travis/springernature/truffler/master.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringernature%2Ftruffler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringernature%2Ftruffler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringernature%2Ftruffler/lists"}