{"action":"opened","issue":{"url":"https://api.github.com/repos/webdriverio/webdriverio/issues/1668","repository_url":"https://api.github.com/repos/webdriverio/webdriverio","labels_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/1668/labels{/name}","comments_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/1668/comments","events_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/1668/events","html_url":"https://github.com/webdriverio/webdriverio/issues/1668","id":185439515,"number":1668,"title":"Looping through commands","user":{"login":"jharrowmortelliti","id":8211311,"avatar_url":"https://avatars.githubusercontent.com/u/8211311?v=3","gravatar_id":"","url":"https://api.github.com/users/jharrowmortelliti","html_url":"https://github.com/jharrowmortelliti","followers_url":"https://api.github.com/users/jharrowmortelliti/followers","following_url":"https://api.github.com/users/jharrowmortelliti/following{/other_user}","gists_url":"https://api.github.com/users/jharrowmortelliti/gists{/gist_id}","starred_url":"https://api.github.com/users/jharrowmortelliti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jharrowmortelliti/subscriptions","organizations_url":"https://api.github.com/users/jharrowmortelliti/orgs","repos_url":"https://api.github.com/users/jharrowmortelliti/repos","events_url":"https://api.github.com/users/jharrowmortelliti/events{/privacy}","received_events_url":"https://api.github.com/users/jharrowmortelliti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-26T16:08:24Z","updated_at":"2016-10-26T16:08:24Z","closed_at":null,"body":"I am trying to loop through an array of commands.\r\nI tried to copy the solution this issue:  #1043\r\nRight now it is hitting the selection action before going to bing.\r\n```\r\nconst browser = require('./browser.js')\r\nconst cheerio = require('cheerio')\r\nconst q = require('q')\r\n\r\nconst testData = [\r\n  {action: 'goToUrl', target: 'www.bing.com'},\r\n  {action: 'doText', target: '#sb_form_q',  textInput: 'hi'}\r\n]\r\n\r\nlet readyTasks = []\r\n\r\nconst doTasks  = (tasks) => {\r\n\r\n  let index=0\r\n\r\n  browser.init()\r\n    .then(() => {\r\n      tasks.forEach((task) => { \r\n        if (task.action==='goToUrl')\r\n          readyTasks.push(browser.url(task.target).pause(5000))\r\n        if (task.action==='doClick')\r\n          readyTasks.push(browser.click(task.target).pause(5000))\r\n        if (task.action==='doText')\r\n          readyTasks.push(browser.setValue(task.target, task.textInput).pause(5000))\r\n      })\r\n      return q.all(readyTasks)\r\n    }).end()\r\n    .then(() => {\r\n      console.log(\"complete\")\r\n    })\r\n}\r\n\r\ndoTasks(testData)\r\n```"}}
{"actor":{"display_login":"jharrowmortelliti"}}