如何单击隐藏在我的文本框中的按钮以角落的图像形式进行 Appium 移动测试
我需要点击图片。如果我单击该图像,它将显示
一个弹出窗口,我无法使用 UIAUTOMATOR VIEWER 为图像单独找到定位器,因为图像在我的文本框中,所以请帮助我克服这个问题,我无法继续。
我正在使用 UIautomator 查看器工具来查找更独特的定位器?
您可以使用TouchAction并按坐标单击:
WebElement accountTextBox = driver.findElement(By.id("account_edit_text"));
Point point = accountTextBox.getLocation();
int shiftX = accountTextBox.getSize().width - 5; // you can adjust it
int shiftY = accountTextBox.getSize().height/2;
new TouchAction(driver)
.press(point.x + shiftX, point.y + shiftY)
.waitAction(ofSeconds(1))
.release()
.perform();
您也可以使用Appium-desktop并尝试将automationName
功能设置为UIAutomator2
并检查它要构建的 XML:它可能会将按钮解析为单独的元素。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句