0

exceptionenter image description hereI am trying to get all the web elements in a section/panel as shown using the above code. But, I am getting only the labels of few drop down boxes and inside options of one drop down. Also, I am not getting the results for buttons. dashboardI have to do this exercise for 60 such dashboards. Kindly look into my code and screen shots and the results.

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]
  • I tried with this xpath: but I am getting the size in an array as 19 which is not considering the one with INDIVIDUAL but considering date fields and buttons(submit, clear, export) which are not of button type. List elementlist = driver.findElements(By.xpath(".//div/button")); – Suneel Kuppili Sep 16 '16 at 07:38

1 Answers1

1

This is because the whole web page is not loaded yet.You can add Selenium wait for elements unitl the whole web page gets loaded.Wait for page load in Selenium

Community
  • 1
  • 1
Sakalya
  • 568
  • 5
  • 15