Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97785

Error :Cannot instantiate the type Select in selenium webdriver

$
0
0

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

}

Viewing all articles
Browse latest Browse all 97785

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>