Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How to verify if we can select multiple options in a static dropdown in Selenium?
We can verify if we can select multiple options in a static dropdown in Selenium with the help of isMultiple() method. It returns a Boolean value of true or false.
Example
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
import java.util.List;
import org.openqa.selenium.support.ui.Select;
public class OptionsMultiple{
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String url = "https://www.tutorialspoint.com/tutor_connect/index.php";
Select s = new Select(driver.findElement(By.xpath("//select[@name=’selType’]")));
// isMultiple() returns a boolean value
boolean result = s.isMultiple();
System.out.println(result);
driver.close();
}
} Advertisements
