I know I can find element by id:
driver.findElement(By.xpath("//*[@id='some_id']"));
And I can find all elements with this id, but I want to find all elements with an id attribute. I’m looking for something like:
driver.findElements(By.xpath("//*[@id]"));
// or
driver.findElements(By.xpath("//*[@id='*']"));
// or
driver.findElements(By.xpath("//*[contains(@id)]"));
I’m using Java. Thanks!
UPD: The only solution for me is to get all elements by "//*", go through them and get their id attributes. Is there a way to get all attributes at once, something like "//*@A" from Java?
Attribute A of element where A contains ‘t’
or
Attribute A of any element
or
//*@Aso I use java too. So if you need to find all elements with id attribute you can simply use
Hope this helps you.
ALso look here. Nice manual for xpath and css selectors