How to deselect selected options from a list box using selenium webdriver

package selenium_examples;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;



public class spicejet {

public static void main(String[] args) {


 WebDriver driver = new FirefoxDriver();

 driver.get("http://jobsearch.naukri.com/mynaukri/mn_newsmartsearch.php");

 Select droplist = new Select(driver.findElement(By.id("idqi")));

       droplist.selectByVisibleText("Accounting / Finance");
       droplist.selectByVisibleText("Agriculture / Dairy");
       droplist.deselectAll();
       System.out.println("Deselected selected options");
}
  }


 deselectAll() method - Clears all selected options.


No comments:

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge