You can use locators to find the textbox and then search for a keyword you like.
1. Open Google and right click to inspect element. You can use F12 also to inspect elements.
![](https://www.edureka.co/community/?qa=blob&qa_blobid=1770674872659545651)
2. Go to the searchbox and inspect the web element you can use for your purpose.
![](https://www.edureka.co/community/?qa=blob&qa_blobid=5427483173473822522)
You can see that there is a name field, I will use it for finding the search box.
Here is the code that I am using:
System.setProperty("webdriver.chrome.driver","C:\\Users\\Downloads\\chromedriver.exe");
WebDriver wd = new ChromeDriver();//create an instance for webdriver named wd of type chrome
wd.get("https://www.google.com");//open google
WebElement elem = wd.findElement(By.name("q"));//finding the web element using name locator
elem.sendKeys(new String[]{"selenium is fun"});
elem.submit();
Output:
![](https://www.edureka.co/community/?qa=blob&qa_blobid=2555989584471984374)