Created
July 5, 2018 16:41
-
-
Save ValchanOficial/98835c6862e3527d12f2a99b1d00e115 to your computer and use it in GitHub Desktop.
selenium-webdriver-click-on-hidden-elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/12363038/selenium-webdriver-click-on-hidden-elements | |
WebElement elem = yourWebDriverInstance.findElement(By.xpath("//*[@class='goog-menu goog-menu-vertical uploadmenu density-tiny']/input")); | |
String js = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';"; | |
((JavascriptExecutor) yourWebDriverInstance).executeScript(js, elem); | |
The above bunch would change the visibility of your file input control. You can then proceed with the usual steps for file upload like: | |
elem.sendKeys("<LOCAL FILE PATH>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment