RE: How to read from multiples select (drop down winndows) in the same script and store by their labels
I am trying to write a script where i can read all the drop down elements in a web page and store them by categorizing with their parent labels.
Ex: Go the the below website.
You can see “Purpose of Mortgage or Loan” as thee label to identify the first Drop Down in the same way “Type of Property” for the second drop down.
Would like to Write a script in such a way that if i print the options by label, it should print as
Purpose of Mortgage or Loan
Home Mortgage Refinance
Debt Consolidation Loan
Type of Property
Can someone please help me in writing this script and shed some light on the way to achieve it.
Use findElements(), it returns a list of WebElements.
In your case, you can use findelements on drop-down elements.Save them in a List<WebElement> of drop-down elements, iterate over all items in the list and get the require attribute from all elements using get attribute method and print them.
Give it a try,it’s simple.