Locate a heading by its tag name
Automation taskEasyAsked in: Accenture, Capgemini, TCS, Wipro
A tag name such as h2 or tr is rarely unique, so interviewers ask when it is useful. The common answer: to read every row, link or header cell inside a parent element you have already found. Here you find the page heading (an h2) by its tag name and print its visible text.