Working with LIST AND DROPDOWN in Webdriver


WEBDRIVER

1st Way         // To Work on dropdown or List we need to create object of Select class
  Select dateselect =  new Select(driver.findElementById("f_mydata"));
  
  // Here we have 3 options to select an element 
  dateselect.selectByIndex(1);
  dateselect.selectByValue("15");
  dateselect.selectByVisibleText("MyData");


2nd Way         // Just Write code in 1 line rather than writing in 2 differnt line

                     new Select(driver.findElementById("f_mydata")).selectByIndex(0);


No comments :

No comments :

Post a Comment