无法使用appium在uiactionsheet下单击uiabutton

时间:2014-12-21 16:13:35

标签: java appium

我正在尝试在UIAButton元素中执行tap事件,该元素位于UIActionSheet元素内。

Appium服务器无法执行操作。

Appium Verion:1.3.3 XCode版本:6.1.1 设备:iPhone模拟器(iOS 8.1)

我还尝试使用javascript执行程序执行点击,但没有成功

Java代码:

WebElement btnInstall = mobiledriver.findElementByIosUIAutomation("UIATarget.localTarget().frontMostApp().actionSheet().elements()[1].elements()[0].elements()[0]");
Map<String, Object> tapOptions = new HashMap<String, Object>();
tapOptions.put("x", (double)btnInstall.getLocation().x);
tapOptions.put("y", btnInstall.getLocation().y);
tapOptions.put("element", ((RemoteWebElement)btnInstall).getId());
JavascriptExecutor js = (JavascriptExecutor)mobiledriver;
js.executeScript("mobile: tap", tapOptions);

Appium Server日志中没有错误,按钮成功找到并且Tap似乎已执行,但appium服务器,我猜不会返回任何响应,也不是模拟器上的屏幕更新了按钮单击,不会进入下一个屏幕。

以下是frontMostApp的logElementTree()输出:

UIAApplication "Settings" {{0, 20}, {375, 647}}
elements: {
UIAWindow "(null)" {{0, 0}, {375, 667}}
elements: {
UIANavigationBar "Warning" {{0, 20}, {375, 44}}
elements: {
UIAImage "(null)" {{0, 0}, {375, 64}}
elements: {
UIAImage "(null)" {{0, 64}, {375, 0.5}}
}
UIAButton "Cancel" {{8, 28}, {54, 30}}
UIAButton "Back" {{8, 31.5}, {21, 21}}
UIAStaticText "Warning" {{155, 28}, {65, 27}}
UIAButton "Install" {{320, 28}, {47, 30}}
}
UIATableView "(null)" {{0, 0}, {375, 667}}
elements: {
UIATableGroup "Unsigned Profile" {{0, 64}, {375, 55.5}}
elements: {
UIAStaticText "Unsigned Profile" {{0, 64}, {375, 55.5}}
}
UIATableCell "The profile is not signed." {{0, 119.5}, {375, 41}}
elements: {
UIAStaticText "The profile is not signed." {{10, 129.5}, {355, 20.5}}
}
}
UIAActionSheet "(null)" {{8, 563}, {359, 96}}
elements: {
UIAScrollView "(null)" {{8, 563}, {359, 0}}
elements: {
UIAImage "(null)" {{8, 560.5}, {359, 2.5}}
UIAStaticText "(null)" {{24, 0}, {327, 0}}
UIAStaticText "(null)" {{24, 0}, {327, 0}}
UIAImage "(null)" {{364.5, 1127}, {2.5, 7}}
}
UIACollectionView "(null)" {{8, 563}, {359, 44}}
elements: {
UIACollectionCell "Install" {{8, 563}, {359, 44}}
elements: {
UIAButton "Install" {{8, 563}, {359, 44}}
}
}
UIAButton "Cancel" {{8, 615}, {359, 44}}
}
}
UIAWindow "(null)" {{0, 0}, {375, 667}}
UIAWindow "(null)" {{0, 0}, {375, 667}}
elements: {
UIAStatusBar "(null)" {{0, 0}, {375, 20}}
elements: {
UIAElement "Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" {{6, 0}, {38, 20}}
UIAElement "3 of 3 Wi-Fi bars" {{49, 0}, {13, 20}}
UIAElement "11:59 PM" {{162, 0}, {51, 20}}
UIAElement "100% battery power" {{345, 0}, {25, 20}}
}
}
}

Appium服务器日志有点大,我因此链接到它们:https://discuss.appium.io/uploads/default/490/4600a39a82609469.txt

0 个答案:

没有答案