I was dealing with a search input box icon which is clicked to open the input box. Since the icon is hidden I used JavaScriptExecutor to click on it and open the search input, like
WebElement searchBtn = driver.findElement(By.className("search-toggle"));
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript ("arguments[0].click();" , searchBtn);
But now, I need to enter some text into the input and ENTER to submit it. The solution would be to use the JavascriptExecutor again, like
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("document.getElementById(**'gbqfq'**).value = 'search text';");
This time, the elementId 'gbqfq' is un known, right ? How do I go around this problem?