Skip to content
Extract the view state value from an html page parsed with [cheerio](https://github.com/MatthewMueller/cheerio)
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
index.js
makefile
package.json

README.md

Get View State

Extract the view state value from an html page parsed with cheerio Build Status

Installation

npm install -S get-view-state

Usage

var inspect = require('eyespect').inspector();
var cheerio = require('cheerio')
var getViewState = require('get-view-state')

// file path to a webpage with a view state element in the html
var filePath = path.join(__dirname, 'data/yesViewState.html') 
var html = fs.readFileSync(filePath, 'utf8')
var $ = cheerio.load(html)

// extract the value attribute from the view state element
var viewState = getViewState($)
inspect(viewState, 'extracted view state')
Something went wrong with that request. Please try again.