| Tag Name | Specification | |
| <ul> | Defines an unordered list of items. | |
| <tr> | Defines a row of cells in a table. | |
| <title> | Represents title to an HTML document. | |
| <th> | Used for creates header of a group of cell in HTML table. | |
| <table> | Used to defines a table in an HTML document. | |
| <tbody> | Used for grouping table rows. | |
| <td> | Used for creates standard data cell in HTML table. | |
| <span> | Used to grouping and applying styles to inline elements. | |
| <section> | Used to divide a document into number of different generic section. | |
| <select> | Used to create a drop-down list. | |
| <menu> | Used to display a unordered list of items/menu of commands. | |
| <li> | Define a list item either ordered list or unordered list. | |
| <iframe> | Defines a inline frame that embedded external content into current web document. | |
| <img> | Used to insert image into a web document. | |
| <input> | Define a get information in selected input | |
| <div> | Define a division part | |
| <body> | Defines a main section(body) part in HTML document | |
| <br /> | Specific a single line break | |
| <button> | Specifies a press/push button | |
| <a> | Specific a anchor (Hyperlink) | |
| Description | XPath | CSS Selector |
| Whole WebPage | /html | html |
| Whole WebPage body | /html/body | body |
| image element | //img | img |
| Link | //a[@href = 'url'] | a[href = 'url'] |
| Direct Child | //div/a | div > a |
| Id | //tagName[@id=’idValue’] | tagName#idValue |
| Class | //tagName[@class=’classValu e’] | tagName.Value of Class attribute |
| Attribute | //tagname[@attribute- name=’value1′] | tagName[attribute=Valu e of attribute] |
| Multiple Attributes | //input[@type='submit' and @name='btnLogin'] | tagname[attribute1='val ue1'][attribute2='value2' ] |
| Contains | //*[contains(@type,'sub')] | <HTML tag><[attribute*=sub String]> |
| Starts with | //tagname[starts- with(@attribute, ‘Start value’)] | <HTML tag><[attribute^=prefix of the String]> |
| Ends with | //tagname[ends- <HTML with(@attribute, ‘End value’)] tag><[attribute$=suffix of the String]> | |
| Matches | //*[matches(@type,'value')] | N/A |
| First Child | //ul[@id=’list’]/li[1] | ul#list li:first-child |
| Last Child | //ul[@id=’list’]/li[last()] | ul#list li:last-child |
| nth Child | //ul[@id=’list’]/li[3] | ul#list li:nth-child(3) |
| Text Value | //td[text()=‘textname'] | N/A |
| Element preceding some sibling | //E2/preceding-sibling::E1 | N/A |
| Sibling element immediately preceding | //E/preceding-sibling::*[1] | N/A |
| User interface element that is disabled | //E[@disabled] | E:disabled |
| Checkbox (or radio button) that is checked | //*[@checked] | *:checked |
| Text Value | //td[text()=‘textname'] | N/A |
Selenium most used tag name and their specification 👇
February 13, 2022
0
Tags: