Why do I get the below error while trying to use the Selenium WebDriver Select class in my test case:
The import org.openqa.selenium.support.ui.Select conflicts with a type defined in the same file
Please help**.**
Thanks,
VS
Why do I get the below error while trying to use the Selenium WebDriver Select class in my test case:
The import org.openqa.selenium.support.ui.Select conflicts with a type defined in the same file
Please help**.**
Thanks,
VS
Just a stab in the dark…
Do you have something else called “Select”? Try:
Import Issue with org.openqa.selenium.support.ui.Select as DropDown
And use it as DropDown wherever you want to use Select.
It works now, thnx Russ
I’m having an issue related to this with the constructor being found. Can you help?
Error: ERROR] - Could not find matching constructor for: org.openqa.selenium.support.ui.Select(com.kms.katalon.core.testobject.TestObject
Using your example above I specify dropdown
import org.openqa.selenium.support.ui.Select as DropDown
Here’s the code:
public class VerifyDropdownValues_AlphabeticalOrder {
static WebDriver driver = DriverFactory.getWebDriver()
static WebElement element = null
@Keyword
public static void verifyOptionsInDropdownInAphabeticalOrder(element) {
DropDown ele = new DropDown(element)
List expectedOptions = new ArrayList<>()
List actualOptions = new ArrayList<>()
for (WebElement option : ele.getOptions()) {
System.out.println("Dropdown options are: " + option.getText())
actualOptions.add(option.getText())
expectedOptions.add(option.getText())
}
Collections.sort(actualOptions)
System.out.println("Numbers of options present in the dropdown: " + actualOptions.size())
Assert.assertEquals(expectedOptions.toArray(), actualOptions.toArray())
System.out.println(“Yes Dropdown values are in Alphabetical order”)
}
}