Skip to content

Commit

Permalink
fix: windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Dec 6, 2022
1 parent ba0434b commit 365d907
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class WdaClientImpl implements WdaClient {
private final String WEB_ELEMENT_IDENTIFIER = "element-6066-11e4-a52e-4f735466cecf";
private int FIND_ELEMENT_INTERVAL = 3000;
private int FIND_ELEMENT_RETRY = 5;
private WindowSize size;

public WdaClientImpl() {
respHandler = new RespHandler();
Expand Down Expand Up @@ -156,18 +155,15 @@ public void checkSessionId() throws SonicRespException {

@Override
public WindowSize getWindowSize() throws SonicRespException {
if (size == null) {
checkSessionId();
BaseResp b = respHandler.getResp(HttpUtil.createGet(remoteUrl + "/session/" + sessionId + "/window/size"));
if (b.getErr() == null) {
size = JSON.parseObject(b.getValue().toString(), WindowSize.class);
logger.info("get window size %s.", size.toString());
} else {
logger.error("get window size failed.");
throw new SonicRespException(b.getErr().getMessage());
}
checkSessionId();
BaseResp b = respHandler.getResp(HttpUtil.createGet(remoteUrl + "/session/" + sessionId + "/window/size"));
if (b.getErr() == null) {
logger.info("get window size %s.", b.getValue().toString());
return JSON.parseObject(b.getValue().toString(), WindowSize.class);
} else {
logger.error("get window size failed.");
throw new SonicRespException(b.getErr().getMessage());
}
return size;
}

@Override
Expand Down

0 comments on commit 365d907

Please sign in to comment.