Learning Selenium – (Video 4) Tutorial Series – Search Text and Submit

This is fourth video in the series of Learning Selenium, In this video search text field and search button automation explained using www.digitalappconsultancy.com website.

If you feel this video is useful, Please share it with your friends on Facebook, twitter Google plus etc.

Code developed in this tutorial provided below:

import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class HelloWorld {

    /**
     * @param args
     * @throws InterruptedException 
     */
    public static void main(String[] args) throws InterruptedException {
        // TODO Auto-generated method stub
        
        // Replace the path of chrome driver according to your setup
        System.setProperty("webdriver.chrome.driver", "/Users/Niranjan/My Briefcase/My Development/eclipse_learning/SeleniumLearning/lib/webdrivers/chromedriver");
        
        ChromeDriver driver = new ChromeDriver();
        driver.get("http://www.digitalappconsultancy.com");
        
        WebElement searchElement = driver.findElementByName("s");
        searchElement.sendKeys("iPhone");
        
        WebElement searchButton = driver.findElementByClassName("search-icon");
        searchButton.click();
        
        Thread.sleep(5000);
        driver.quit();

    }

}

 
For further reading refer Java Selenium Programming Category posts.

Share this post

Learning Selenium Java Search Field Example
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *