How can I find html elements base on wfd-id using selenium?
You can use css and form your selector such as tag[wfd-id='foo']
For example. If you have an element <div wfd-id="username">
, you could select it using:
"div[wfd-id='username']"
Hard to say until you provide HTML and your existing code.
You can use an attribute CSS selector to match on the attribute wfd-id
and apply via .FindElementsByCss
to return the collection of WebElements
. You then loop and access individual elements content using .Text
property.
Dim elems As WebElements, elem As WebElementSet elems = bot.FindElementsByCss("[wfd-id]")For Each elem In elems Debug.Print elem.TextNext
If you are sure that its id is unique then you can use xpath in findelement;
driver.findelement(By.xpath("//*[@wdf-id='905']"))