0

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?

0

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 elementsTwo = driver.findElementsByClassName("SomeClassName");

| improve this answer | |

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.