How to locate webelement using CSSSelector in selenium webdriver ?
- <Tag Name>#<[id='value']> for search with id
- <Tag Name>.<[classname='value']> for search with classname
- <Tag Name><[Attributename*='value']> for partial search
- <Tag Name><[Attributename^='value']> for start with
- <Tag Name><[Attributename$='value']> for ends with
- <Tag Name><[Attributename='value'] for exact content match of single attribute
- <Tag Name><[Attributename1='value'][Attributename2='value'] for exact content match of more than one attributes
- ParentTagName > ChildTagName[AttributeName='value'] for finding through unique parent. Use greater than sign.
- ParentTagName[AttributeName='value'] > TagName for finding direct child
- ParentTagName[AttributeName='value'] TagName for finding all direct and indirect child(Sub child)
- nth-child(n): Example is .classname > TagName:nth-child(1)
- nth-last-child(n): Example is .classname > TagName:nth-last-child(1)
- first-child: Example is .classname > TagName:first-child
- last-child: Example is .classname > TagName:last-child
- Sibling: Example is .classname > TagName:nth-child(1) + TagName
- All sibling: Example is .classname > TagName:nth-child(1) ~ TagName
- Identify checked checkbox: Example is <TagName>:checked
- What is Tag Name?
- What is Attributename?
- What is value?
- What is Parent Tag?
- What is Sibling
- What is Child?
No comments:
Post a Comment