I am testing a website with selenium webdriver.
I have imported all the jar files also, but still could not use Select Class in eclipse. It gives me an error: Select class cannot be instantiated.
I have also imported org.openqa.selenium.support.ui.Select
Following is my source 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);
}
}