update yiewd example with new yiewd syntax

This commit is contained in:
Jonathan Lipps
2013-09-14 13:18:51 +02:00
parent 09d06f63cd
commit d82449e0d2
2 changed files with 14 additions and 16 deletions
+13 -15
View File
@@ -15,26 +15,24 @@ var driver = wd.remote('localhost', 4723);
var bc = function(t) { return "//button[contains(@text, '" + t + "')]"; };
var ec = function(t) { return "//editText[contains(@text, '" + t + "')]"; };
var tc = function(t) { return "//text[contains(@text, '" + t + "')]"; };
driver.byX = driver.elementByXPath.bind(driver);
driver.byN = driver.elementByName.bind(driver);
driver.run(function*() {
try {
yield this.init(desiredCaps);
yield this.setImplicitWaitTimeout(5000);
yield (yield this.byX(bc('Create'))).click();
yield (yield this.byX(ec('Name'))).sendKeys("John Smith");
yield (yield this.byX(ec('Phone'))).sendKeys("(555) 555-5555");
yield (yield this.byX(ec('Email'))).sendKeys("john.smith@google.io");
yield (yield this.byX(tc('Done'))).click();
yield (yield this.byN("Add to favorites")).click();
yield (yield this.byN("Edit")).click();
yield (yield this.byX(tc('Mobile'))).click();
yield (yield this.byX("//checkedTextView[@text='Home']")).click();
yield (yield this.byX(tc('Done'))).click();
yield (yield this.byN("More options")).click();
yield (yield this.byX(tc('Delete'))).click();
yield (yield this.byX(bc('OK'))).click();
yield this.elementByXPath(bc('Create')).click();
yield this.elementByXPath(ec('Name')).sendKeys("John Smith");
yield this.elementByXPath(ec('Phone')).sendKeys("(555) 555-5555");
yield this.elementByXPath(ec('Email')).sendKeys("john.smith@google.io");
yield this.elementByXPath(tc('Done')).click();
yield this.elementByName("Add to favorites").click();
yield this.elementByName("Edit").click();
yield this.elementByXPath(tc('Mobile')).click();
yield this.elementByXPath("//checkedTextView[@text='Home']").click();
yield this.elementByXPath(tc('Done')).click();
yield this.elementByName("More options").click();
yield this.elementByXPath(tc('Delete')).click();
yield this.elementByXPath(bc('OK')).click();
} catch(e) {
console.log(e);
}