Confused by the many locators strategies, which one is best and support all? (please read details)

Hi Tester

Could you please save an intern day and help me on this issue that I have been working on all day without a solution

So I have a mobile app that I want to test on a real device, I am using these capabilities

udid=‘d645ad32’ ,
platformName= ‘Android’ ,
appPackage= com.cybertel.voip.nokia ,
appActivity= ‘com.cybertel.voip.ui.main.CallMainActivity’ ,
autoGrantPermissions= True
,
noReset= True

the appium inspector gives this attributes for an element for an example

image

I am just following a tutorial and trying to practice so might be I missed something since I am using a particalr app

The issue is I can only access the element by ID, which does not solve my task as some elements does not have ID so I need to access them by Name

driver1.find_element(by=AppiumBy.NAME, value=‘VOIP CLIENT UPDATE’)

I get this error

selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy ‘name’ is not supported for this session

can anyone please help me on how to select any element with the attributes

TIA

Just by id ‘btn_update’. Appium will add package name itself.

1 Like

it is just an example, but many other elements has no id and have text or name attribute, anyway I found a really good explanation https://www.skill2lead.com/appium-python/appium-python-by-text-locator.php
this blog is a treasure for anyone using appium with python, kudos to this hero @wreed and thank you also @Aleksei for your active responses