Selenium - Find all elements of a web page Selenium - Find all elements of a web page selenium selenium

Selenium - Find all elements of a web page


Yes, there is a way.

Here is some pseudo-code:

List<WebElement> el = driver.findElements(By.cssSelector("*"));for ( WebElement e : el ) {  add(e.tagName());}


non-pseudo C# version of above: (although I'm just displaying the results in a console

IReadOnlyCollection el = driver.FindElements(By.CssSelector("*"));

            foreach (IWebElement elm in el)            {                Console.WriteLine(elm.TagName + elm.Text);            }