Search code examples
javaseleniumwebdriver

How to select from list options within loop through them select each option and find the value from database - using selenium webdriver - JAVA


I want it to be in for loop, that to find the date from dropdown and match it with the date which is stored in database. and then select it.otherwise test case Failed.

for mean while. I'm beginners in selenium. so I just want to add on my work place a new things. the dropdown name is " Year of Birth ", that having multiple years.

I will appreciate that. thanks

Note: able to select from Option for each value. but my question here to add a loop condition that to match the data from the database.


Solution

  • SOLVED BY USING

    driver.findElement(YearOfBisrth).click();
            Select selectBirth = new Select(driver.findElement(YearOfBisrth));
            driver.findElement(YearOfBisrth).click();
            selectBirth.selectByValue(data.get("YearBirth"));