{"action":"created","issue":{"url":"https://api.github.com/repos/n1k0/casperjs/issues/1500","repository_url":"https://api.github.com/repos/n1k0/casperjs","labels_url":"https://api.github.com/repos/n1k0/casperjs/issues/1500/labels{/name}","comments_url":"https://api.github.com/repos/n1k0/casperjs/issues/1500/comments","events_url":"https://api.github.com/repos/n1k0/casperjs/issues/1500/events","html_url":"https://github.com/n1k0/casperjs/issues/1500","id":143684378,"number":1500,"title":"Adding extension as native Casperjs function","user":{"login":"entrptaher","id":8284972,"avatar_url":"https://avatars.githubusercontent.com/u/8284972?v=3","gravatar_id":"","url":"https://api.github.com/users/entrptaher","html_url":"https://github.com/entrptaher","followers_url":"https://api.github.com/users/entrptaher/followers","following_url":"https://api.github.com/users/entrptaher/following{/other_user}","gists_url":"https://api.github.com/users/entrptaher/gists{/gist_id}","starred_url":"https://api.github.com/users/entrptaher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entrptaher/subscriptions","organizations_url":"https://api.github.com/users/entrptaher/orgs","repos_url":"https://api.github.com/users/entrptaher/repos","events_url":"https://api.github.com/users/entrptaher/events{/privacy}","received_events_url":"https://api.github.com/users/entrptaher/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/n1k0/casperjs/labels/Enhancement","name":"Enhancement","color":"02e10c"},{"url":"https://api.github.com/repos/n1k0/casperjs/labels/General%20Discussion","name":"General Discussion","color":"eeeeee"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-03-26T09:52:08Z","updated_at":"2016-04-05T20:19:35Z","closed_at":null,"body":"This repo has .label() and .goto() extension for casperjs. \r\nhttps://github.com/yotsumoto/casperjs-goto\r\n\r\nWhen you code a macro/testing script, sometimes you face situations where you have to go back to x step if a condition didn't match. i.e,\r\n\r\n```\r\nGo to google.com,\r\nClick about,\r\nIf has text \"I'm feeling lucky\" click it,\r\nelse go back to **1st** step.\r\n```\r\n\r\nNo I am not talking about repeat() function. I am talking about where you can jump through steps at your will. Just like how we use goto in a batch/shell file. Surely you can bypass() steps, but what about going nth step backward?\r\n\r\nIs there any hope of these extensions to become part of original CasperJS repo?\r\n\r\nNOTE: the first casperjs issue was about this too. No solution even after this many years?\r\nhttps://github.com/n1k0/casperjs/issues/1"},"comment":{"url":"https://api.github.com/repos/n1k0/casperjs/issues/comments/205974729","html_url":"https://github.com/n1k0/casperjs/issues/1500#issuecomment-205974729","issue_url":"https://api.github.com/repos/n1k0/casperjs/issues/1500","id":205974729,"user":{"login":"entrptaher","id":8284972,"avatar_url":"https://avatars.githubusercontent.com/u/8284972?v=3","gravatar_id":"","url":"https://api.github.com/users/entrptaher","html_url":"https://github.com/entrptaher","followers_url":"https://api.github.com/users/entrptaher/followers","following_url":"https://api.github.com/users/entrptaher/following{/other_user}","gists_url":"https://api.github.com/users/entrptaher/gists{/gist_id}","starred_url":"https://api.github.com/users/entrptaher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entrptaher/subscriptions","organizations_url":"https://api.github.com/users/entrptaher/orgs","repos_url":"https://api.github.com/users/entrptaher/repos","events_url":"https://api.github.com/users/entrptaher/events{/privacy}","received_events_url":"https://api.github.com/users/entrptaher/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T20:19:35Z","updated_at":"2016-04-05T20:19:35Z","body":"Say, we have a dynamic page that shows different output depending on user action. No matter which one we follow, it will end up to a page 2. Page 2 is same for all those dynamic outputs. But it doesn't stop here, we have a page 3 which leads to page 1 or page 4 depending on users action.\r\n\r\nSay, you create a project that uses this conditional operation for 20 different pages, always going back and forth depending on the users behavior. What would you do? Just rewrite \"some code\"? \r\n\r\nIf you say using bypass. Well, if you just add a little .then() inside the code, you have to give a different target for .bypass() function.\r\n\r\nWe can bypass the steps forward, but going backwards is a problem. We can use a function with some if else condition. But...we'll be less productive. Of course we will still use conditionals to judge whether we should go backwards to a certain label or not.\r\n\r\nWait, I'll share some code when I'm done."}}