I was writing a code for my website for testing purpose.I added/imported all the jar files also, but still could not use Select Class in eclipse.
It throws an error: Select class cannot be instantiated.
Below is my code:
import org.apache.bcel.generic.Select; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; public class Dropdown { public static void main(String[] args) { // TODO Auto-generated method stub WebDriver driver = new FirefoxDriver(); driver.get("
http://www.makemytrip.com"); WebElementaddress=driver.findElement(By.xpath(".//[@id='to_typeahead1']")); Select sc = new Select (address); // ERROR LINE sc.selectByIndex(5); } }