I am using appium and dot-net-driver.
Im trying to go thru all activity's of an app and get all the elements on every page.
but im unable to find the right way to get a list of all elements.
i tried to use c# regular expressions but with no luck.
if anyone have stumbled upon this issue and can help it will be much appreciated!
what i have tried to do:
public void getElementToFile()
{
//var elementsList = driver.FindElementsByXPath("//android.widget");
var elementsList = driver.FindElementsByClassName("android.widget");
foreach(var element in elementsList){
WritingText(element.Text);
}
}
Use the UI Automator API, in particular the UiSelector class to locate elements. In Appium you send the Java code, as a string, to the server, which executes it in the application's environment, returning the element or elements.
When using Appium findElement by XPath, the program analyzes the XML structure of the app and locates a particular element relative to other elements. In fact, originally this strategy was developed to navigate XML data in order to locate unique UI elements. Remember that XPath selectors are not cross-platform.
In the Appium version 1.0 onwards, findElementByTagName is deprecated. Show activity on this post. You can find the ID of an element using android uiautomatorviewer. just go to your SDK tools folder D:\Android\android-sdk\tools, here you can find uiautomatorviewer.
var elementsList = driver.FindElementsByXPath("//*");
Btw i must warn that you shouldnt do this because it will not be efficient at all. You need to use specific xpaths and ID's for any automation. And this has nothing to do with your Language or driver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With