I am using selenium and its WebDriver API to do a quick google search for something.
The examples that are usually given include this:
driver.get("https://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese");
element.submit();
Apparently this will search for 'Cheese' in google. But I'm not sure where they got 'q' from or how it relates to google's search bar?
Thanks
. See full image
Inspect the html of the search bar in google search page. And this is what you get -
From here you can see different attributes like name etc.