Select By Partial Text

Select in Selenium works very well, but only if you know what you are looking for. If you are working with manual testers who migh make mistakes defining variables or dealing with very huge strings or foreign language this solution should be very handy to you.


Ofcourse for that you’ll need Selenium WebDriver and you’ll have to use TestNG(this one is replacable).

So essentially it’s a very easy solution, you handle select drop down as a table.

public void selectElementByPartialText(WebElement element, String search){
List<WebElement> optionList= element.findElements(By.tagName("option"));
 for(WebElement el : optionList){



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s