Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (11.4k points)

I am trying to simulate a test case where i have to select multiple option from a multipleselect box. i can do this using select. however i am getting following error as soon as i instantiate select.

"Cannot instantiate the type Select"

my code is:

import java.awt.List;
import java.util.ArrayList;

import junit.framework.Assert;

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.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class SeleniumFormTesting {
//piece of code to open the browser in firefox

Select selectBox = new Select(driver.findElement(By
            .cssSelector("select#id_contact")));
//in above select statement the error comes

}


can someone please help me in getting rid of this problem

1 Answer

0 votes
by (32.3k points)

Simply just import the Select import package into your project using:

import org.openqa.selenium.support.ui.Select;

Browse Categories

...