1

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?

1 Answer 1

1

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

On java, it’s:

driver.getPageSource()

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");
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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