Skip to content

Commit

Permalink
feat: add ios attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Dec 24, 2022
1 parent 97ffc0b commit 2c8dc1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ public String getAttribute(String name) throws SonicRespException {
BaseResp b = wdaClient.getRespHandler().getResp(
HttpUtil.createGet(wdaClient.getRemoteUrl() + "/session/"
+ wdaClient.getSessionId() + "/element/" + id + "/attribute/" + name), 60000);

throw new SonicRespException("ios not implemented getAttribute");
if (b.getErr() == null) {
logger.info("get %s attribute %s.", id, name);
return b.getValue().toString();
} else {
logger.info("get %s attribute %s.", id, name);
throw new SonicRespException(b.getErr().getMessage());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public void testFindElement() throws SonicRespException, InterruptedException, I
w.sendKeys(text);
Assert.assertEquals(text, w.getText());
w.clear();
Assert.assertEquals("搜索地点或地址", w.getAttribute("name"));
Assert.assertEquals("搜索地点或地址", w.getText());
ElementRect elementRect = w.getRect();
Assert.assertTrue(elementRect.getX() > 0);
Expand Down

0 comments on commit 2c8dc1a

Please sign in to comment.