Skip to content

Latest commit

 

History

History
78 lines (59 loc) · 2.54 KB

jsonwire-mobile.md

File metadata and controls

78 lines (59 loc) · 2.54 KB

Mobile JsonWire Protocol Methods

Wd.js is incrementally implementing the Mobile JsonWire Protocol Spec

-ios uiautomation Locator Strategy

Find elements in iOS applications using the UIAutomation Javascript API

eg:

wd.elementsByIosUIAutomation('.tableViews()[0].cells()', function(err, el){
  el.elementByIosUIAutomation('.elements()["UICatalog"]', function(err, el){
    el.getAttribute('name', function(err, name){
      console.log(name);
    });
  });
});

-ios class chain Locator Strategy

Find elements in iOS applications using the WebDriverAgent Class Chain API

eg:

wd.elementsByIosClassChain('XCUIElementTypeWindow/XCUIElementTypeAny[`value == "bla1" OR label == "bla2"`]', function(err, el){
  el.getAttribute('name', function(err, name){
    console.log(name);
  });
});

-ios predicate Locator Strategy

Find elements in iOS applications using the WebDriverAgent Predicate API

eg:

wd.elementsByIosPredicateString('type IN {`XCUIElementTypeIcon`,`XCUIElementTypeImage`} AND visible == 1', function(err, el){
  el.getAttribute('name', function(err, name){
    console.log(name);
  });
});

-android uiautomator Locator Strategy

Find elements in android applications using the UiSelector Class

eg:

wd.elementsByAndroidUIAutomator('new UiSelector().clickable(true)', function(err, els){
  console.log("number of clickable elements:", els.length);
});

-android datamatcher Locator Strategy

Find elements in android applications using Espresso Data Matcher

e.g.:

wd.elementsByAndroidDataMatcher(JSON.stringify({name: "hasEntry", args: ["title", "ViewTitle"]})', function(err, els){
  console.log("number of clickable elements:", els.length);
});

accessibility id

Find elements by whatever identifier is used by the platforms Accessibility framework.

eg:

wd.elementByAccessibilityId("Submit", function(err, el){
  el.click();
});