Reputation: 52665
I need to automate file uploading.
Here is a HTML
code for path-to-file input field and button for manual uploading:
<div class="ctrl_div">
<input id="fileupload" class="hid" name="files" accept="application/zip" data-url="/Server/file/upload" type="file">
<button id="fileBtn" class="btn btn-primary" type="button">Upload</button>
</div>
When I try
driver.find_element_by_xpath('//input[@id="fileupload"]').send_keys(path_to_file)
I get ElementNotVisibleException
I also tried
driver.execute_script("document.getElementById('fileupload').style.visibility = 'visible';")
But input field remains invisible for webdriver
.
Any ideas?
P.S. Adding implicit/explicit wait will not make a trick
Upvotes: 0
Views: 284
Reputation: 2444
You should try with
driver.execute_script(document.getElementById('fileUpload').style.display='block';");
Upvotes: 1