Last active
August 29, 2015 14:21
-
-
Save michaelwills/f362e2368422f80ea831 to your computer and use it in GitHub Desktop.
Use intern.io to iterate and click elements sequentially
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// uses when | |
// reduce and when suggested https://gist.github.com/michaelwills/f362e2368422f80ea831#comment-1454585 | |
var when = require('intern/dojo/promise/when'); | |
// snippet from previous this.remote sequence | |
this.remote | |
.findAllByCssSelector('.tile') | |
.then(function onTileImages(tiles) { | |
return tiles.reduce(function iterTiles(prev, tile) { | |
return when(prev) | |
.then(function iterTile() { | |
return tile.click() | |
.then(function () { return remote.pressKeys('\uE00C'); }) | |
.then(function () { return remote.sleep(500); }); | |
}); | |
}, null); | |
}) | |
.end(); |
neonstalwart
commented
May 15, 2015
Thanks @neoonstalwart!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment