我正在尝试在Google云端硬盘中自动上传文件功能.
用于传递参数的元素隐藏为height - 0px.
任何用户操作都不会使此元素可见.所以我需要一个工作来点击元素不可见.
<input type="file" style="height: 0px; visibility: hidden; position: absolute; width: 340px; font-size: inherit;" multiple=""/>
Run Code Online (Sandbox Code Playgroud)
上述元素的xpath是 -
//*[@class='goog-menu goog-menu-vertical uploadmenu density-tiny']/input
Run Code Online (Sandbox Code Playgroud)
我在用
WebDriver.findElement(By.xpath(<xpath>).sendKeys(<uploadFile>)
Run Code Online (Sandbox Code Playgroud)
例外 -
org.openqa.selenium.ElementNotVisibleException
Run Code Online (Sandbox Code Playgroud)
我尝试过使用JavascriptExecutor.但无法找到确切的语法.