Compare the today date in the calender selected date if it is same click on ok button

	SelectStartDate.click();
	DateFormat dateFormat = new SimpleDateFormat("dd MMMMM yyyy");
	Date date = new Date();
	System.out.println(dateFormat.format(date));
	for(int i=0; i==DateList.size(); i++)
	{
		
	//	if(DateList.get(i).isSelected())			
		//{
			//System.out.println(DateList.get(i).isSelected());
			//String date = DateList.get(i).getText();
			//if(date==dateWithoutTime)
			if(DateList.get(i).getText().equals(date))
			{
				
				
				OKButton.click();
				
			}
			break;
			
		}
		
	}

}

HERE IF STATEMENT IS not getting executed. could you please tell me why?

What does DateList.size() return?

That’s one of the strangest for loops I’ve ever seen.

DateList this is page factory it returns the number of elements, it returns the size of the webelement in that list.

Is the value of DateList.size() 0? Because your for loop will exit if DateList.size() is not 0. If the value is zero it will run once. Could I suggest reading up on how for loops work?

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html