{"action":"created","issue":{"url":"https://api.github.com/repos/n1k0/casperjs/issues/1491","repository_url":"https://api.github.com/repos/n1k0/casperjs","labels_url":"https://api.github.com/repos/n1k0/casperjs/issues/1491/labels{/name}","comments_url":"https://api.github.com/repos/n1k0/casperjs/issues/1491/comments","events_url":"https://api.github.com/repos/n1k0/casperjs/issues/1491/events","html_url":"https://github.com/n1k0/casperjs/issues/1491","id":142320384,"number":1491,"title":"waitFor*() has a very unclear behaviour","user":{"login":"nerder","id":3502356,"avatar_url":"https://avatars.githubusercontent.com/u/3502356?v=3","gravatar_id":"","url":"https://api.github.com/users/nerder","html_url":"https://github.com/nerder","followers_url":"https://api.github.com/users/nerder/followers","following_url":"https://api.github.com/users/nerder/following{/other_user}","gists_url":"https://api.github.com/users/nerder/gists{/gist_id}","starred_url":"https://api.github.com/users/nerder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nerder/subscriptions","organizations_url":"https://api.github.com/users/nerder/orgs","repos_url":"https://api.github.com/users/nerder/repos","events_url":"https://api.github.com/users/nerder/events{/privacy}","received_events_url":"https://api.github.com/users/nerder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/n1k0/casperjs/labels/Packaging","name":"Packaging","color":"777777"}],"state":"open","locked":false,"assignee":{"login":"BIGjuevos","id":1751088,"avatar_url":"https://avatars.githubusercontent.com/u/1751088?v=3","gravatar_id":"","url":"https://api.github.com/users/BIGjuevos","html_url":"https://github.com/BIGjuevos","followers_url":"https://api.github.com/users/BIGjuevos/followers","following_url":"https://api.github.com/users/BIGjuevos/following{/other_user}","gists_url":"https://api.github.com/users/BIGjuevos/gists{/gist_id}","starred_url":"https://api.github.com/users/BIGjuevos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BIGjuevos/subscriptions","organizations_url":"https://api.github.com/users/BIGjuevos/orgs","repos_url":"https://api.github.com/users/BIGjuevos/repos","events_url":"https://api.github.com/users/BIGjuevos/events{/privacy}","received_events_url":"https://api.github.com/users/BIGjuevos/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-03-21T11:26:09Z","updated_at":"2016-04-13T17:42:14Z","closed_at":null,"body":"Hello guys,\r\nIs about one day that i'm trying to understand how all the `waitFor*()` functions are suppose to work.\r\nThis is my example implementation\r\n\r\n```javascript\r\nvar casper = require('casper').create({\r\n  remoteScripts:  [\r\n    'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js',\r\n    'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.6.1/lodash.js'\r\n  ],\r\n  pageSettings: {\r\n    userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.1500.71 Safari/537.36'\r\n  },\r\n  viewport: {\r\n    width: 1280,\r\n    height: 1024\r\n  },\r\n  waitTimeout: 60000,\r\n  logLevel: 'debug',\r\n  verbose: true\r\n});\r\n\r\ncasper.start('https://web.whatsapp.com/', function(){\r\n    this.echo('Starting...')\r\n    this.waitForSelector(\".qrcode\", (function() {\r\n        this.captureSelector(filename, \"html\");\r\n        this.echo(\"Saved screenshot of \" + (this.getCurrentUrl()) + \" to \" + filename);\r\n    }), (function() {\r\n        this.echo(this.getHTML());\r\n        this.die(\"Timeout reached. Fail whale?\");\r\n        this.exit();\r\n    }), 15000);\r\n});\r\n\r\ncasper.run();\r\n```\r\nWhat i'm expecting here, is that `waitForSelector()` will continuously fetch the DOM, until it will not found the `<div class=\"qrcode\"></div>` in a certain amount of time (15s in that example), but actually what it seems to do, is just loading the page after 15s and check if there is or not that selector, that actually i don't get why this will be useful (if not for some WAF avoiding that don't like to receive a lot of request in a short time). Than if `waitingFor*()` is not what i'm looking for, what i can use to accomplish this task? I have a working implementation using PhantomJS and `setTimeout()`, but i'm looking for something smarter.\r\n\r\nAny Clue? Am i missing something?\r\n\r\nCheck even my SO question: http://stackoverflow.com/questions/36128875/casperjs-waitfor-has-very-unclear-behaviour\r\n\r\nThank you in advance\r\n\r\ncc @istr , @mickaelandrieu , @paazmaya , @n1k0 "},"comment":{"url":"https://api.github.com/repos/n1k0/casperjs/issues/comments/209560229","html_url":"https://github.com/n1k0/casperjs/issues/1491#issuecomment-209560229","issue_url":"https://api.github.com/repos/n1k0/casperjs/issues/1491","id":209560229,"user":{"login":"istr","id":4235579,"avatar_url":"https://avatars.githubusercontent.com/u/4235579?v=3","gravatar_id":"","url":"https://api.github.com/users/istr","html_url":"https://github.com/istr","followers_url":"https://api.github.com/users/istr/followers","following_url":"https://api.github.com/users/istr/following{/other_user}","gists_url":"https://api.github.com/users/istr/gists{/gist_id}","starred_url":"https://api.github.com/users/istr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/istr/subscriptions","organizations_url":"https://api.github.com/users/istr/orgs","repos_url":"https://api.github.com/users/istr/repos","events_url":"https://api.github.com/users/istr/events{/privacy}","received_events_url":"https://api.github.com/users/istr/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T17:42:14Z","updated_at":"2016-04-13T17:42:14Z","body":"> with the expected dependencies\r\n\r\nOk, let's have a look into that. The current releases stopped auto-installing any PhantomJS version at all (exactly because of the nearly unsolvable problem to choose the correct engine version for every situation), so we should update the brew packaging to reflect this."}}