如何在Android中选择Appium中的文本

发布于 2025-01-19 05:22:17 字数 2809 浏览 0 评论 0原文

**Appium version:** 

Xpath: 
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.RelativeLayout/androidx.recyclerview.widget.RecyclerView/android.widget.RelativeLayout[5]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.TextView
android.widget.TextView[@text='Test Group']"

如何在Appium中选择我的文本?**

**I tried many thing but Unable to click....**
List results = driver.findElements(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(" + "new UiSelector().text(\"Test Group\"))"));
((WebElement) results).click();

Result : Nothing
List<WebElement> SelectGroup = driver.findElements(By.xpath("//android.widget.LinearLayout[@resource-id='com.flipkart.android:id/product_list_product_item_layout']/android.widget.RelativeLayout[@index='1']")); 
((WebElement) SelectGroup).click();

Result : Nothing

我用这些依赖项列表使用:

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.1.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>8.0.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

根据最新版本的Appium,请帮助我解决我的代码上的错误,我将通过在自动化测试中学习来处理。 我展示了许多解决方案,但没有人为我工作。 如果您需要更多详细信息,请问我,我将提供另一个详细信息

enter image description here

**Appium version:** 

enter image description here

Xpath: 
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.RelativeLayout/androidx.recyclerview.widget.RecyclerView/android.widget.RelativeLayout[5]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.TextView
android.widget.TextView[@text='Test Group']"

**I am so Confuse I tried last 2 day to find solution for this my query.

How to Select my text in appium?**

**I tried many thing but Unable to click....**
List results = driver.findElements(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(" + "new UiSelector().text(\"Test Group\"))"));
((WebElement) results).click();

Result : Nothing
List<WebElement> SelectGroup = driver.findElements(By.xpath("//android.widget.LinearLayout[@resource-id='com.flipkart.android:id/product_list_product_item_layout']/android.widget.RelativeLayout[@index='1']")); 
((WebElement) SelectGroup).click();

Result : Nothing

I user those Dependency List:

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.1.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>8.0.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

Please Help me on As per latest version of APPIUM I try to fixed that error on My Code I will process by learning in Automation testing.
I show many Solution but no one is working for me.
if you need more details please ask me I will give another details

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文