简体   繁体   中英

WebDriver file upload through input freezes after sendKeys triggers the upload

WebElement uploadInput = browser.findElementByXPath("[correct_identifier]");
uploadInput.sendKeys(elementPath);

The code correctly starts the upload process, but the custom js loading screen never disappears. When doing it manually , it usually takes about 5 seconds for the whole process. With webdriver , the loading screen triggers a timeout eventually, regardless of how much time I wait for it to disappear.

Other info: on firefox , the sending of keys does nothing . Only on chrome the upload is started and finished (there is a % indicatior showing that it is done, but the loading screen after processing the file does not go away in order to continue the process). The element for the upload looks like this:

       <span class="[classes]">             
         <a href="#" class="[classes]" style="float: right; display: none;"> Cancel</a>
         <input id="[id]" class="multi_file_upload single" type="file" name="filedata" multiple="" data-path="[path]">
       </span>

I cant comment: Can you try sending "Enter" key for the button or mouse double_Click. I have seen similar issues and had to use these workarounds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM