Screenshot that shows the 2 layers of the elements
我在屏幕上有2层元素。第一层是您在背面看到的内容:Facebook,Apple,底部导航栏和顶部按钮栏。并将第二层显示在最底层。第二层具有您在右上角看到的4个按钮:编辑投资组合,设置为我的默认投资组合等。
Appium服务器,无法访问这些元素。具有唯一的ID(content-desc)。
我尝试过的解决方案是单击它们,并为所有这些尝试获得“ NoSuchElementException”:
1)使用xPath->按content-desc
2)我尝试使用“父容器” [list],并从中找到容器内的项目
3)使用xpath->通过获取“父类[索引] /子类[索引]
4)我也尝试过从页面顶部开始向下移动,直到到达按钮
尝试4号是:
WebElement fatheFrameLyout = driver.findElement(By.className("android.widget.FrameLayout"));
WebElement childFrameLayout = fatheFrameLyout.findElements(By.className("android.widget.FrameLayout")).get(21);
WebElement listView = childFrameLayout.findElement(By.className("android.widget.ListView"));
WebElement relativeLayoutButtonElement = listView.findElements(By.id("com.fusionmedia.investing:id/test")).get(3);
relativeLayoutButtonElement.click();
我期望找到这些元素,但是我在想我之所以无法,是因为它在屏幕上显示为第二层[!