Find element by ios_ui not working
Asked Answered
D

1

16
Appium 1.5.0 
Xcode  7.3
IOS 10.11.4 OSX EI Capitan
Using on:Simulator iOS 8.1

My XML

<?xml version="1.0" encoding="UTF-8"?>
<AppiumAUT>
    <UIAApplication  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="false" hint="" path="/0/0" x="0" y="0" width="375" height="667">
        </UIAWindow>
        <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1" x="0" y="0.6875" width="375" height="665.625">
            <UIAImage name="icon-menu-logo.png" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/0" x="11.71875" y="33.5" width="46.875" height="46.875">
            </UIAImage>
            <UIAStaticText  dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/1" x="72.65625" y="37.015625" width="244.921875" height="30.46875">
            </UIAStaticText>
            <UIAStaticText  dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/2" x="72.65625" y="56.9375" width="244.921875" height="24.609375">
            </UIAStaticText>
            <UIATableView name="" label="" value="rows 1 to 12 of 12" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3" x="0" y="122.5625" width="375" height="513.28125">
                <UIATableCell name="MARKETS" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3/0" x="0" y="122.5625" width="375" height="41.015625">
                    <UIAStaticText name="MARKETS" label="MARKETS" value="MARKETS" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3/0/0" x="76.171875" y="128.421875" width="223.828125" height="29.296875">
                    </UIAStaticText>
                </UIATableCell>
                <UIATableCell name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3/10" x="0" y="532.71875" width="375" height="41.015625">
                    <UIAStaticText name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3/10/0" x="0" y="532.71875" width="375" height="41.015625">
                    </UIAStaticText>
                </UIATableCell>
                <UIATableCell name="Sign out" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3/11" x="0" y="573.734375" width="375" height="41.015625">
                    <UIAStaticText name="Sign out" label="Sign out" value="Sign out" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/3/11/0" x="23.4375" y="579.59375" width="280.078125" height="29.296875">
                    </UIAStaticText>
                </UIATableCell>
            </UIATableView>
            <UIAStaticText name="Dev-Cert" label="Dev-Cert" value="Dev-Cert" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/4" x="23.4375" y="633.5" width="207.421875" height="24.609375">
            </UIAStaticText>
            <UIANavigationBar name="AUDIT TRAIL" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/5" x="0" y="24.125" width="375" height="51.5625">
                <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/5/0" x="0" y="0.6875" width="375" height="75">
                    <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/5/0/0" x="0" y="75.6875" width="375" height="0.5859375">
                    </UIAImage>
                </UIAImage>
                <UIAStaticText name="DEV-CERT" label="DEV-CERT" value="DEV-CERT" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/5/1" x="99.609375" y="67.484375" width="175.78125" height="11.71875">
                </UIAStaticText>
                <UIAButton name="icon nav menu" label="icon nav menu" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/5/2" x="5.859375" y="31.15625" width="51.5625" height="35.15625">
                </UIAButton>
                <UIAButton name="Back" label="Back" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/5/3" x="9.375" y="37.6015625" width="24.609375" height="24.609375">
                </UIAButton>
                <UIAStaticText name="AUDIT TRAIL" label="AUDIT TRAIL" value="AUDIT TRAIL" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/5/4" x="125.390625" y="33.5" width="124.8046875" height="31.640625">
                </UIAStaticText>
            </UIANavigationBar>
            <UIATableView name="" label="" value="rows 1 to 8 of 100" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6" x="0" y="75.6875" width="375" height="585.9375">
                <UIATableGroup name="JUNE 16, 2016" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/6/0" x="0" y="75.6875" width="375" height="25.78125">
                    <UIAStaticText name="JUNE 16, 2016" label="JUNE 16, 2016" value="JUNE 16, 2016" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/6/0/0" x="0" y="75.6875" width="375" height="25.78125">
                    </UIAStaticText>
                </UIATableGroup>
                <UIATableCell name="CC Sep17" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1" x="0" y="101.46875" width="375" height="72.65625">
                    <UIAStaticText name="CC Sep17" label="CC Sep17" value="CC Sep17" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1/0" x="7.03125" y="109.671875" width="225" height="18.75">
                    </UIAStaticText>
                    <UIAStaticText name="--" label="--" value="--" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1/1" x="7.03125" y="128.421875" width="180.46875" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="ICE | vivek_01" label="ICE | vivek_01" value="ICE | vivek_01" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1/2" x="7.03125" y="150.6875" width="242.578125" height="21.09375">
                    </UIAStaticText>
                    <UIAStaticText name="Position Reset" label="Position Reset" value="Position Reset" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1/3" x="196.875" y="126.6640625" width="171.09375" height="28.125">
                    </UIAStaticText>
                    <UIAStaticText name="-9 / --" label="-9 / --" value="-9 / --" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1/4" x="241.40625" y="106.7421875" width="126.5625" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="04:01:00" label="04:01:00" value="04:01:00" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/1/5" x="258.984375" y="150.6875" width="108.984375" height="21.09375">
                    </UIAStaticText>
                </UIATableCell>
                <UIATableGroup name="JUNE 15, 2016" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/6/2" x="0" y="174.125" width="375" height="25.78125">
                    <UIAStaticText name="JUNE 15, 2016" label="JUNE 15, 2016" value="JUNE 15, 2016" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/6/2/0" x="0" y="174.125" width="375" height="25.78125">
                    </UIAStaticText>
                </UIATableGroup>
                <UIATableCell name="CC Sep17" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3" x="0" y="199.90625" width="375" height="72.65625">
                    <UIAStaticText name="CC Sep17" label="CC Sep17" value="CC Sep17" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3/0" x="7.03125" y="208.109375" width="225" height="18.75">
                    </UIAStaticText>
                    <UIAStaticText name="Bid @ 0" label="Bid @ 0" value="Bid @ 0" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3/1" x="7.03125" y="226.859375" width="180.46875" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="LIM | DAY | ICE | vivek_01" label="LIM | DAY | ICE | vivek_01" value="LIM | DAY | ICE | vivek_01" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3/2" x="7.03125" y="249.125" width="242.578125" height="21.09375">
                    </UIAStaticText>
                    <UIAStaticText name="Canceled" label="Canceled" value="Canceled" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3/3" x="196.875" y="225.1015625" width="171.09375" height="28.125">
                    </UIAStaticText>
                    <UIAStaticText name="1 / 3" label="1 / 3" value="1 / 3" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3/4" x="241.40625" y="205.1796875" width="126.5625" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="15:13:07" label="15:13:07" value="15:13:07" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/3/5" x="258.984375" y="249.125" width="108.984375" height="21.09375">
                    </UIAStaticText>
                </UIATableCell>
                <UIATableCell name="CC Sep17" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4" x="0" y="272.5625" width="375" height="72.65625">
                    <UIAStaticText name="CC Sep17" label="CC Sep17" value="CC Sep17" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4/0" x="7.03125" y="280.765625" width="225" height="18.75">
                    </UIAStaticText>
                    <UIAStaticText name="--" label="--" value="--" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4/1" x="7.03125" y="299.515625" width="180.46875" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="ICE | vivek_01" label="ICE | vivek_01" value="ICE | vivek_01" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4/2" x="7.03125" y="321.78125" width="242.578125" height="21.09375">
                    </UIAStaticText>
                    <UIAStaticText name="Cancel Request" label="Cancel Request" value="Cancel Request" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4/3" x="196.875" y="297.7578125" width="171.09375" height="28.125">
                    </UIAStaticText>
                    <UIAStaticText name="-- / --" label="-- / --" value="-- / --" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4/4" x="241.40625" y="277.8359375" width="126.5625" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="15:13:05" label="15:13:05" value="15:13:05" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/4/5" x="258.984375" y="321.78125" width="108.984375" height="21.09375">
                    </UIAStaticText>
                </UIATableCell>
                <UIATableCell name="CC Sep17" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5" x="0" y="345.21875" width="375" height="72.65625">
                    <UIAStaticText name="CC Sep17" label="CC Sep17" value="CC Sep17" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5/0" x="7.03125" y="353.421875" width="225" height="18.75">
                    </UIAStaticText>
                    <UIAStaticText name="Ask @ 0" label="Ask @ 0" value="Ask @ 0" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5/1" x="7.03125" y="372.171875" width="180.46875" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="LIM | DAY | ICE | vivek_01" label="LIM | DAY | ICE | vivek_01" value="LIM | DAY | ICE | vivek_01" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5/2" x="7.03125" y="394.4375" width="242.578125" height="21.09375">
                    </UIAStaticText>
                    <UIAStaticText name="Canceled" label="Canceled" value="Canceled" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5/3" x="196.875" y="370.4140625" width="171.09375" height="28.125">
                    </UIAStaticText>
                    <UIAStaticText name="1 / 4" label="1 / 4" value="1 / 4" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5/4" x="241.40625" y="350.4921875" width="126.5625" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="15:13:03" label="15:13:03" value="15:13:03" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/5/5" x="258.984375" y="394.4375" width="108.984375" height="21.09375">
                    </UIAStaticText>
                </UIATableCell>
                <UIATableCell name="CC Sep17" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/6" x="0" y="417.875" width="375" height="72.65625">
                    <UIAStaticText name="CC Sep17" label="CC Sep17" value="CC Sep17" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/6/0" x="7.03125" y="426.078125" width="225" height="18.75">
                    </UIAStaticText>
                    <UIAStaticText name="--" label="--" value="--" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/6/1" x="7.03125" y="444.828125" width="180.46875" height="24.609375">
                    </UIAStaticText>
                    <UIAStaticText name="ICE | vivek_01" label="ICE | vivek_01" value="ICE | vivek_01" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/6/2" x="7.03125" y="467.09375" width="242.578125" height="21.09375">
                    </UIAStaticText>
                    <UIAStaticText name="Cancel Request" label="Cancel Request" value="Cancel Request" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/6/3" x="196.875" y="443.0703125" width="171.09375" height="28.125">
                    </UIAStaticText>
                    <UIAStaticText name="-- / --" label="-- / --" value="-- / --" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/6/6/4" x="241.40625" y="423.1484375" width="126.5625" height="24.609375">
                    </UIAStaticText>

This is a starting part of xml.When i test in appium inspector .tableViews()[1].cells() i get the rows.But when i do it through python appium client , i get an element which has visiblity as false and size location 0.I have checked the xpath version of it online and it works fine but the same in python client fails.Does anybody have any idea on this?

P.S

The strange part is if i try .tableViews()[1].cells()[1].staticTexts() it works fine!!!!!!!!!!!!!!!I also know that the xml is dynamic and changing but we not using xpath so it shouldnt matter i guess.

Dugger answered 18/6, 2016 at 22:52 Comment(5)
Can call with index if key_name is None or non-Unique ! NameSpace is unique definition if talking about python dictionariesHorrible
@Horrible i didnt get youDugger
a = {"b" : "1", "b" : "2"} how to call second value ? a["b"][1] equal to .tableViews()[1].cells()[1].staticTexts(), need all key are unique otherwise only work with index ! is clear ? Of course Python returned last element but returned a list if searching under iterator. So short information : your module work with searching result if got more than one results. Check your module source(appium), on "webdriver.py" include a from selenium.webdriver.remote.webelement import WebElement as SeleniumWebElementHorrible
And got find_elements by what ? id/class etc. ? id returned single element but class returned a list. Check your XML file and count <UIAWindow name="" elements.Horrible
Try to use xpath with properties. Using indexes can be a problemPitch
D
1

Avoiding dup keys, as dsgdfg suggests, will improve the reliability of finding required elements.

Dyeline answered 2/1, 2018 at 1:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.