Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

go-phantomjs

A tiny phantomjs wrapper for go

Usage

import (
  "github.com/urturn/go-phantomjs" // exported package is phantomjs
)

func main() {
  p, err := phantomjs.Start()
  if err != nil {
    panic(err)
  }
  defer p.Exit() // Don't forget to kill phantomjs at some point.
  var result interface{}
  err = p.Run("function() { return 2 + 2 }", &result)
  if err != nil {
    panic(err)
  }
  number, ok := result.(float64)
  if !ok {
    panic("Cannot convert result to float64")
  }
  fmt.Println(number)
  // Output: 4
}

About

A phantomjs wrapper for go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published