 # Test if the specs have finished.
 #
 specsReady = ->
-  page.evaluate -> if document.body.querySelector('.finished-at') then true else false
+  page.evaluate -> window.resultReceived
 
 #
 # SCRIPT START

      page.addLogs(suite)

    console.log JSON.stringify(result, undefined, 2)

  else if /^SPEC_START: (\d+)$/.test(msg)
    currentSpecId = Number(RegExp.$1)

    # Attach the console reporter when the document is ready.
    #
    window.onload = ->
      window.resultReceived = false
      jasmine.getEnv().addReporter(new ConsoleReporter())

# Open web page and run the Jasmine test runner
