update javascript example

This commit is contained in:
Jonathan Lipps
2013-05-16 11:16:12 -06:00
parent c695a7680b
commit 7d8f30f33f
+10 -4
View File
@@ -28,11 +28,17 @@ WD.js:
```js
driver.elementsByTagName('button', function(err, buttons) {
// tap all the buttons
buttons.each(function(button) {
button.tap(function(err) {
var tapNextButton = function() {
var button = buttons.shift();
if (typeof button !== "undefined") {
button.click(function(err) {
tapNextButton();
})
} else {
driver.quit();
});
});
}
}
tapNextButton();
});
```