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?
-
Hi.. are you able to develop the above tool?? Even am planning to develop the same tool.. need your inputs please..user1787641– user17876412014-10-13 12:42:00 +00:00Commented Oct 13, 2014 at 12:42
-
It's still a WIP, but we are progressing.Arya– Arya2014-10-14 16:46:59 +00:00Commented Oct 14, 2014 at 16:46
-
Can you explain the summary of developing procedure??user1787641– user17876412014-10-15 09:16:57 +00:00Commented Oct 15, 2014 at 9:16
-
1It's a swing UI to develop scripts which invokes a javascript to execute those.Arya– Arya2014-10-22 06:11:14 +00:00Commented Oct 22, 2014 at 6:11
Add a comment
|
2 Answers
Yes, there is a way.
Here is some pseudo-code:
List<WebElement> el = driver.findElements(By.cssSelector("*"));
for ( WebElement e : el ) {
add(e.tagName());
}
4 Comments
Arya
Thanks. I'm sure I don't see the cssSelectors in this case. For instance, I tried for google.com, and I get these- Images Maps Play YouTube News Gmail More Sign in
raven
Any idea how to capture custom elements? Have tried using
execute-script document.all but that still seems to return only standard elementsIAmMilinPatel
Will this also get the custom elements(elements/tags that are not default but created by the user, for example, <my-tag></my-tag>)?
ddavison
yes it will. any Dom element. By.cssSelector("my-tag")