Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Find an element by partial attribute value.
- Sample html code : <input id="react-select-2-input">
- Comment : For example the above input element has attribute id contains numeric value "2" the numeric value is a dynamic value and changes when the page is refreshed or loaded.
- In this case we need to find the id by partial value "react-select-" ignoring the rest of the value.
- driver.FindElement(By.CssSelector("[id*=react-select]")).SendKeys("Attraction");
- Comment: Other uses
- (By.CssSelector("[id*=react-select]")) -- use * to find the id value containing "react-select"
- (By.CssSelector("[id#=react]")) -- use # to find the id value begining with "react"
- (By.CssSelector("[id$=input]")) -- use # to find the id value ending with "input"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement