I am writing an automation application for a Website. Therefore I need to steer on HTML Elements, which don't have a ID. I heard that xPath and CSS Selector are not that fastest, that's why I want to change to By.className(). Unfortunately I this isn't working. You can find a Demo (the actual tool is not automating google :D) below.
I am using a GeckoDriver 0.21.0 and Selenium 3.13.0
WebDriver d = new FirefoxDriver();
JavascriptExecutor js = (JavascriptExecutor) d;
d.get("https://www.google.com");
WebElement we = d.findElements(By.className("gLFyf gsfi")).get(0);
js.executeScript("arguments[0].value='test';", we);