I have this code that works where driver is of type IOSDriver<IOSElement>

    string selector = "type == 'XCUIElementTypeButton'"; 
    foreach (var elt in driver.FindElements(MobileBy.IosNSPredicate(selector)))
        Console.WriteLine(elt.Text + "," + elt.TagName);

This code only gets buttons.

How do I get all elements?


You can always get the page source and parse it out yourself.

On java, it’s:


That’ll return an XML string with everything on the page. You can then use your favorite XML parsing library to pick it apart and get any info you need.

Or, you can do something similar:

List<MobileElement> elementsTwo = driver.findElementsByClassName("SomeClassName");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.