I am planning a tool in Java which would have a drop down containing all the elements of a web page. Is there any way I can read those into a data structure?
Yes, there is a way.
Here is some pseudo-code:
List<WebElement> el = driver.findElements(By.cssSelector("*"));
for ( WebElement e : el ) {
add(e.tagName());
}