Auto Suggestion & Auto Complete Text Box in Selenium Web Driver

Auto Suggestion & Auto Complete Text Box in Selenium Web Driver

In this article, we will learn how we can automate/handle Auto suggestions or Autocomplete boxes using selenium Web driver.

But Before that,

What is AutoComplete or Auto suggestion boxes?

In autocomplete boxes application try to predict the values of typed text based on the input value provided earlier. For e.g. in Google Search box whenever the user enters any value google automatically tries to suggest to him the next text based on the value provided earlier.

In this example, we will try to automate Google Search box functionality in which I will try to search “selenium” and based on this input provided it will automatically search “Selenium-web driver” and click on the Search button.

Below is the code snapshot for this.

To understand the above code snapshot.

After entering selenium in the search box I have taken all the suggestions in the list and iterate using for each loop and click whenever I find selenium web driver as output.

The output of the above code execution is



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
November 14, 2021 at 10:08 PM


If the Text is in Span tag under div tag then ??
Its not working for me !!