How to load file in Selenium WebDriver without input element
I have a HTML-page with the button "Upload" and id: btn-import-questions
. Element:
<button class="btn btn-success btn-sm col-lg-11" id="btn-import-questions" data-ts-file-selector="questions-import-init"> Upload <i class="fa fa-upload"></i></button>
I tried Selenium Java code like this:
driver.findElement(By.id("btn-import-questions")).sendkeys("C:/path/to/file.xlsx");
But since it's a download button and not an input-type element, the above code doesn't work.
+3
source to share