How do we locate both Data QA Id and CSS Class using Selenium C# ?
We're trying to locate both a DataQAid attribute and also see if its class ng-invalid, (Angular Material Textbox Error)
This is what wrote so far:
private By PhoneError => By.XPath("//*[@attr.data-qa='homephone']");
Resource: https://stackoverflow.com/questions/24120263/find-element-in-selenium-using-xpath-or-css-selector
Artportraitdesign1
asked Aug 12, 2020 at 20:03
1 Answer 1
By.XPath("//*[@data-qa='homephone-update' and @class='ng-invalid']");
Try this
answered Aug 13, 2020 at 8:37
-
This answers the how to use both attr and class. I do not think it solves the issue of the OP, as the data-qa field is homephone-update.Niels van Reijmersdal– Niels van Reijmersdal2020年08月13日 10:01:16 +00:00Commented Aug 13, 2020 at 10:01
-
@NielsvanReijmersdal thanks Niel i updated it , i didnt notice the remaininggPDHide– PDHide2020年08月13日 10:08:42 +00:00Commented Aug 13, 2020 at 10:08
@attr.data-qa
instead of@data-qa