我正在尝试使用上面的代码获取部分/面板中的所有Web元素。但是,我只得到几个下拉框的标签和一个下拉的内部选项。另外,我没有得到按钮的结果。 我必须为60个这样的仪表板进行此练习。请仔细查看我的代码和屏幕截图以及结果。
List<WebElement> elementlist = driver.findElements
(By.xpath(".//*[@id='idBSRT']/div/div[contains(@class, 'card-
inner')]/section/div[contains(@id,'update')]"));
List<String> all_elementlist=new ArrayList<>();
for(int ele=0; ele<elementlist.size(); ele++)
{
all_elementlist.add(elementlist.get(ele).getText());
System.out.println(elementlist.get(ele).getText());
}
Results:
Sub Country
All
Region
All
Sub Region
All
Territory
All
Select Village
All
Executor
All
Segment
All
Activity Type
All
Package or Individual
Select
INDIVIDUAL
PACKAGE
Activity
1 selected
Select Season
All
Crop
All
Brand
All
Activity Status
All
Select From Date
Select To Date
done[![enter image description here][1]][1]