Appium Python iOS
el.text and get_attribute('label') etc. all seem to pulling accessibility information. Is there a way to pull the actual text that is displayed on screen using Appium? I need to be able to pull for a given element.
Appium Python iOS
el.text and get_attribute('label') etc. all seem to pulling accessibility information. Is there a way to pull the actual text that is displayed on screen using Appium? I need to be able to pull for a given element.
It does not return visible text if you use .text
You need to ask the developer to add a new attribute in the iOS code with the actual mention of the original url text. Then you will be able to see the new attribute in the Appium element locator table. If this is not done there is no value in the appium element locator table to give you the visible text
You can use .text
element = driver.find_element_by_class_name("class_name").text
print(element)
it will return you text and verify f you required.
Try this one it will help you
element = driver.find_element_by_class_name("class_name").get_attribute('text')
print(element)
or Second one - Give you exact text from android ui
element = driver.findElementByAndroidUIAutomator("new UiSelector().className(\"android.widget.EditText\")").get_attribute('text')
print(element)
I am quite sure, that .text will give you the element's text when the element is visible.
Beware, Appium does give you an empty string here, if it deems the element not visible (out of screen- bounds or hidden or behind another element). If you need to get the text of elements which are not visible, you may try this one driver.find_element_by_class_name("class_name").get_attribute('textContent')