gpt4 book ai didi

java - 如何在 ios 移动应用程序中单击可见= false 的元素

转载 作者:太空宇宙 更新时间:2023-11-04 09:05:04 25 4
gpt4 key购买 nike

我必须自动化一个 iOS pega 移动应用程序,那里有一个我需要单击的字段。但该字段设置为可见的“false”。有没有办法让我点击该元素?

Image of the mobile screen

  1. 我使用的方法(1)单击“时间(秒)”文本字段,但将其设置为可见 false

字符串选择器 = "type=='XCUIElementTypeStaticText' AND rect.x==101 AND rect.y==150 AND(visible == 0 ORenabled == 1)";
MobileElement timeEle = driver.findElementByIosNsPredicate(selector);
timeEle.click();

  • 我使用的方法(2)单击“时钟”图标,即使我使用了谓词字符串,它仍然不起作用。
  • Appium 中显示的 xpath,

    //XCUIElementTypeOther[@name="Center Panel, region"]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[4]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[3]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther

    最佳答案

    使用隐藏元素时,您通常需要使用 JavaScript 与它们交互。

    在java中,按照你的例子,这看起来像

    import org.openqa.selenium.JavascriptExecutor; # added to the top of the script
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("arguments[0].click()", timeEle);

    关于java - 如何在 ios 移动应用程序中单击可见= false 的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60311208/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com