Forum Discussion
It's an Angular-based app. I just found a public sample page, where this can be tested:
https://material.angular.dev/components/chips/overview#autocomplete
I've updated the test project with this particular page and elements.
Basically, I need to find all mat-chip-rows and click [x] button for each row. Of course, I know there is an easy way to achieve this by using name mapping and simple loop. But I can't use it that way. This project is just a simplified sample. In original project, I'm collecting all form inputs (using the complicated xpath) and do various things for each input. Basically collecting IDs/values, storing them in JSON, eventually loading IDs/values from JSON and filling individual form inputs. Therefore, I'm working on a generic method, which should work with various forms, containing variable number and types of elements.
Hello!
I'm also working on an Angular project. For this type of project, I exclusively use XPath to retrieve my objects.
In your example, here's what I would do:
let ar = page.FindElements("//div[@role='presentation']//mat-chip-row"); //page is your parent object, this xpath returns an array of all the mat-chip-row inside your div.