0

UIAutomator - メイン アクティビティ ページ

要素を見つけるためのEclipseコード:

`

System.out.println("Context"+driver.getContext() + "Activity: " + 
     driver.currentActivity());
     //Finding element action_search
    try{

    driver.findElement(By.id("com.shopioca.shop:id/action_search")).click();}catch(Exception e){}
        try{
        driver.findElement("android.widget.TextView", "com.shopioca.shop:id/action_search").click();}catch(Exception e1){}
        try{
        driver.findElementByAccessibilityId("Find Order").click();}catch(Exception e1){}
        try{
        driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"com.shopioca.shop:id/action_search\")").click();}catch(Exception e1){}
        try{
        driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.shopioca.shop:id/action_search\")")).click();}catch(Exception e1){}
        try{
        driver.findElementByClassName("android.widget.TextView").click();}catch(Exception e1){}
        try{
        driver.findElementByXPath("//android.widget.TextView[contains(@resource-id,'com.shopioca.shop:id/action_search')]").click();}catch(Exception e1){}
        try{
        driver.findElementByXPath("//android.widget.TextView[contains(@condent-desc,'Find Order')]").click();}catch(Exception e1){}
        try{
        driver.findElementByXPath("//android.support.v7.widget.LinearLayoutCompat[@index='3']/android.widget.TextView[@index='0']").click();}catch(Exception e1){}
`

Appium サーバー - エラー:

[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.TextView[contains(@resource-id,'com.shopioca.shop:id/action_search')]","context":"","multiple":false}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//android.widget.TextView[contains(@resource-id,'com.shopioca.shop:id/action_search')]' using 'XPATH' with the contextId: '' multiple: false
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//android.widget.TextView[contains(@resource-id,'com.shopioca.shop:id/action_search')]' using 'XPATH' with the contextId: '' multiple: false
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"No element found"}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[debug] [BaseDriver] Waited for 21331 ms so far

このページには要素が見つかりませんでした。ログイン アクティビティ要素が見つかり、メイン アクティビティ ページに正常に表示されました。しかし、このページには要素が見つかりませんでした。アドバイスをください、事前に感謝します。

4

1 に答える 1