Appium 切换上下文环境

Appium 切换上下文环境,代码如下:

    private void switchToContext(String sContext) {
LogManager.getLogger(this.getClass()).info("Swith to Context: " + sContext);
Set<String> contextNames = driver.getContextHandles();
LogManager.getLogger(this.getClass()).info("Exists Contexts: " + contextNames.toString());
for (String contextName : contextNames) {
if (contextName.contains(sContext)) {
driver.context(contextName);
LogManager.getLogger(this.getClass()).info("Swith to Context SUCCESS.");
break;
}
}
}
上一篇:ActionContext.getContext()用法


下一篇:jQuery+ajax实现局部刷新