ふつうはこう書けば20秒立った時にexitする。
setTimeout ->
console.error 'execution timeout.'
phantom.exit 10
, 20 * 1000
リソースのロードのタイムアウトはこれ
page.onResourceTimeout = () ->
console.error 'resource timeout'
js loopで止まらない時はこれ。 Define the new page callback for interrupting a long-running JavaScript · efcc6c7 · ariya/phantomjs
page.onLongRunningScript = () ->
でもけっきょくphantomごと止めちゃうようなのがあるので外側でtimeout監視してkillするひつようあり。