Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

JamesMGreene/phantomjs-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

phantomjs-solutions

A collection of the more interesting PhantomJS scripts that I've created as workarounds for various users on the mailing list and issue tracker.

The latest PhantomJS (1.9.1 as of the time of writing this documentation) will "hang" (i.e. not exit automatically) if it encounters a parse error (syntax error) in the script it is executing unless the user has defined an appropriate phantom.onError handler to catch all unhandled exceptions and forcibly exit. While adding the phantom.onError handler is ALWAYS the best practice, some users would prefer that PhantomJS exit automatically in its default phantom.onError handler so that they do not have to define their own phantom.onError handler in every PhantomJS script they create. While their desired behavior does make sense and mimics the behavior of similar engines (e.g. Node.js), I proposed a chain-loading script to serve as a workaround (perhaps temporarily, perhaps permanently).

This script sets up an appropriate phantom.onError handler and then executes the target script specified as the first arg to the chain-loader script, including adjusting all of the phantom and system values to behave as if the target script had been the one executed from the shell rather than the chain-loader script.

  • Created for:       ariya/phantomjs#10687
  • Created on:       2013-05-23
  • Last updated:    2013-06-20

The latest PhantomJS (1.9.1 as of the time of writing this documentation) does not yet realistically support the window.navigator.onLine status, nor its associated online and offline events. As a temporary workaround for testing purposes, I proposed a script that overrides the pertinent window.navigator properties and event dispatching. Unfortunately, the only way to control this behavior is by exposing a new globally accessible function; in this script, it is called: _change_onLine.

  • Created for:       ariya/phantomjs#10647
  • Created on:       2013-06-19
  • Last updated:    2013-06-19

Someone on the mailing list asked a question about changing a single property on window.navigator (userAgent, in this case) without having to do a lot of work to set all of the other properties.

About

A collection of the more interesting PhantomJS scripts that I've created as workarounds for various users on the mailing list and issue tracker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published