Working with LIST AND DROPDOWN in selenium


Working with LIST AND DROPDOWN in selenium

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);



RC


  // Working with List
  selenium.addSelection("ElementLocator", "Value");
  // Working with Dropdown
  selenium.select("ElementLocator", "Value");



No comments :

No comments :

Post a Comment