【发布时间】:2015-12-22 01:04:06
【问题描述】:
我单击 myApplication 中的链接将我重定向到 safari,现在我想关闭 safari 并以相同状态打开 myApplication? appium 不支持主页按钮。
试过了,
1.
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("UIATarget.localTarget().deactivateAppForDuration(5);
但它正在关闭并再次打开 Safari 应用程序。如何切换到 myApplication 而不是 safari?
2。 Appium 默认方法似乎不适用于 IOS,
driver.closeApp();
driver.launchApp();
退出驱动程序。
3.
JavascriptExecutor js = (JavascriptExecutor) driver;
Object result = js.executeScript("mobile: closeApp");
HashMap<String, String> args = new HashMap<String, String>();
args.put("bundleId", "com.myApplication.iphone");
js.executeScript("mobile: launchApp", args);
得到“org.openqa.selenium.WebDriverException:尚未实现”错误。
4.
Runtime runtime = Runtime.getRuntime();
String[] args = {"osascript", "-e", "tell app \"safari\" to quit"};
runtime.exec(args);
runtime = Runtime.getRuntime();
String[] cmd = { "osascript", "-e", "tell app \"myApplication\" to launch" };
runtime.exec(cmd);
不工作。
5.
try {
Robot robot = new Robot();
// Simulate a key press
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_H);
// Simulate a key press
robot.keyRelease(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
} catch (AWTException e) {
e.printStackTrace();
}
不工作
【问题讨论】:
标签: ios automation appium