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?
我正在计划一个Java工具,它将包含一个包含网页所有元素的下拉列表。有什么方法可以将它们读入数据结构吗?
1 个解决方案
#1
22
Yes, there is a way.
是的,有办法。
Here is some pseudo-code:
这是一些伪代码:
List<WebElement> el = driver.findElements(By.cssSelector("*"));
for ( WebElement e : el ) {
add(e.tagName());
}
#1
22
Yes, there is a way.
是的,有办法。
Here is some pseudo-code:
这是一些伪代码:
List<WebElement> el = driver.findElements(By.cssSelector("*"));
for ( WebElement e : el ) {
add(e.tagName());
}