Guest User

Untitled

a guest
Dec 11th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. (function () {
  2. "use strict";
  3. var system = require("system");
  4. var url = system.args[1];
  5.  
  6. phantom.viewportSize = {width: 800, height: 600};
  7.  
  8. console.log("Opening " + url);
  9.  
  10. var page = new WebPage();
  11.  
  12. // This is required because PhantomJS sandboxes the website and it does not
  13. // show up the console messages form that page by default
  14. page.onConsoleMessage = function (msg) {
  15. console.log(msg);
  16.  
  17. // Exit as soon as the last test finishes.
  18. if (msg && msg.indexOf("Dixi.") !== -1) {
  19. phantom.exit();
  20. }
  21. };
  22.  
  23. page.open(url, function (status) {
  24. if (status !== 'success') {
  25. console.log('Unable to load the address!');
  26. phantom.exit(-1);
  27. } else {
  28. // Timeout - kill PhantomJS if still not done after 2 minutes.
  29. window.setTimeout(function () {
  30. phantom.exit();
  31. }, 120 * 1000);
  32. }
  33. });
  34. }());
Add Comment
Please, Sign In to add comment