I am trying to use the HtmlUnitDriver and WebElement classes for Selenium in Java to click the Download as CSV button in Google trends.
The problem is that this button is hidden (not displayed) until you click another button on the settings menu, but I cannot click this button on the settings menu using WebElement.
Here is my code:
public static void main(String[] args)
{
HtmlUnitDriver hud = new HtmlUnitDriver();
hud.get("https://www.google.com/trends/explore#q=" + args[0] + "&date=today%203-m&cmpt=q&tz=Etc%2FGMT%2B8");
WebElement element = hud.findElement(By.id("settings-menu-button"));
element.click();
}
The error I get is: org.openqa.selenium.ElementNotVisibleException: you can only interact with visible elements
But is the settings menu button visible?
This is the first time I am making such a program and using this library, so thanks for any help. I am still studying.