java – Appium检查器在iOS中找不到日期选择器的xpath

嗨,我正在使用selenium尝试与我的iOS应用程序的日期选择器进行交互.然而,在appium检查器中,我看不到xpath,甚至没有选择日期选择器来与之交互.

我该如何与它互动.当我单击复制xml并将其粘贴到浏览器中时,我也没有在树中看到日期选择器.

《java – Appium检查器在iOS中找不到日期选择器的xpath》

编辑:添加我执行Grid.driver().getPageSource()时出现的xml行,而不是仅仅从Appium复制xml …只有我看到添加到它上面的东西是UIANavigationBar和UIAToolbar

        <UIAApplication name="myApp" label="myApp" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0" x="0" y="0" width="375" height="667">
    <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0" x="0" y="0" width="375" height="667">
        <UIAStaticText name="Filter By Date" label="Filter By Date" value="Filter By Date" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0" x="117" y="19.5" width="124.5" height="25">
        </UIAStaticText>
        <UIATableView name="FilterV-TableView-FilterOptions" label="" value="rows 1 to 5 of 5" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1" x="0" y="64" width="375" height="603">
            <UIATableCell name="ActivityVC-TableView-PredefinedFilterItem[0][0]" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/0" x="0" y="27" width="375" height="55">
                <UIAStaticText name="ActivityVC-TableView-PredefinedFilterItem[0][0]" label="Past 90 Days " value="Past 90 Days " dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/1/0/0" x="18" y="45" width="87.5" height="19">
                </UIAStaticText>
            </UIATableCell>
            <UIATableCell name="ActivityVC-TableView-PredefinedFilterItem[0][1]" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/1" x="0" y="82" width="375" height="55">
                <UIAStaticText name="ActivityVC-TableView-PredefinedFilterItem[0][1]" label="September " value="September " dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/1/0" x="18" y="100" width="73" height="19">
                </UIAStaticText>
            </UIATableCell>
            <UIATableCell name="ActivityVC-TableView-PredefinedFilterItem[0][2]" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/2" x="0" y="137" width="375" height="55">
                <UIAStaticText name="ActivityVC-TableView-PredefinedFilterItem[0][2]" label="2015 " value="2015 " dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/2/0" x="18" y="155" width="35.5" height="19">
                </UIAStaticText>
            </UIATableCell>
            <UIATableCell name="ActivityVC-TableView-PredefinedFilterItem[0][3]" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/3" x="0" y="192" width="375" height="55">
                <UIAStaticText name="ActivityVC-TableView-PredefinedFilterItem[0][3]" label="2014 " value="2014 " dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/3/0" x="18" y="210" width="35.5" height="19">
                </UIAStaticText>
            </UIATableCell>
            <UIATableGroup name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/1/4" x="0" y="247" width="375" height="20">
            </UIATableGroup>
            <UIATableCell name="CUSTOM DATE RANGE" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/5" x="0" y="267" width="375" height="400">
                <UIAStaticText name="CUSTOM DATE RANGE" label="CUSTOM DATE RANGE" value="CUSTOM DATE RANGE" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/5/0" x="19" y="279" width="118" height="15">
                </UIAStaticText>
                <UIAStaticText name="From" label="From" value="From" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/5/1" x="18" y="318" width="28" height="15">
                </UIAStaticText>
                <UIAStaticText name="To" label="To" value="To" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/5/2" x="193" y="318" width="13" height="15">
                </UIAStaticText>
                <UIAButton name="FilterV-Button-FromDate" label="From" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/5/3" x="18" y="333" width="164" height="35">
                </UIAButton>
                <UIAButton name="FilterV-Button-ToDate" label="To" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1/5/4" x="193" y="333" width="164" height="35">
                </UIAButton>
            </UIATableCell>
        </UIATableView>
        <UIAButton name="FilterV-Button-Cancel" label="Cancel" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/2" x="113.5" y="565" width="64" height="64">
        </UIAButton>
        <UIAButton name="FilterV-Button-Done" label="Done" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/3" x="197.5" y="565" width="64" height="64">
        </UIAButton>
        <UIANavigationBar name="myApp.ActivityFilterView" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4" x="0" y="-44" width="375" height="44">
            <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4/0" x="0" y="-64" width="375" height="64">
                <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4/0/0" x="0" y="0" width="375" height="0">
                </UIAImage>
            </UIAImage>
            <UIAButton name="Back" label="Back" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4/1" x="8" y="-35.5" width="24" height="24">
            </UIAButton>
        </UIANavigationBar>
        <UIAToolbar name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/5" x="0" y="667" width="375" height="44">
            <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/5/0" x="0" y="666.5" width="375" height="0.5">
            </UIAImage>
            <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/5/1" x="0" y="667" width="375" height="44">
            </UIAImage>
        </UIAToolbar>
    </UIAWindow>
    <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1" x="0" y="0" width="375" height="667">
    </UIAWindow>
    <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/2" x="0" y="0" width="375" height="667">
        <UIAStatusBar name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/2/0" x="0" y="0" width="375" height="20">
            <UIAElement name="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/2/0/0" x="6" y="0" width="38" height="20">
            </UIAElement>
            <UIAElement name="3 of 3 Wi-Fi bars" label="3 of 3 Wi-Fi bars" value="" dom="" enabled="true" valid="true" visible="false" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/2/0/1" x="49" y="0" width="13" height="20">
            </UIAElement>
            <UIAElement name="3:17 PM" label="3:17 PM" value="" dom="" enabled="true" valid="true" visible="false" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/2/0/2" x="165" y="0" width="45" height="20">
            </UIAElement>
            <UIAElement name="100% battery power" label="100% battery power" value="" dom="" enabled="true" valid="true" visible="false" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/2/0/3" x="345" y="0" width="25" height="20">
            </UIAElement>
        </UIAStatusBar>
    </UIAWindow>
</UIAApplication>

最佳答案 您可以与它进行交互,但问题仅在于Appium检查员没有显示它.如果从代码中打印出带有driver.getPageSource()的XML树,则可以在XPath中看到这些元素并使用它们.

至少这就是我为我的项目解决这个问题的方法.

点赞