2016-09-26 53 views
0
WebElement uploadInput = browser.findElementByXPath("[correct_identifier]"); 
uploadInput.sendKeys(elementPath); 

代碼正確啓動上傳過程,但自定義js加載屏幕從不消失。 手動操作時手動操作,整個過程通常需要5秒左右。與webdriver,加載屏幕最終觸發timeout,無論我等待它消失多少時間。通過輸入WebDriver文件上傳後,sendKeys觸發上傳

其他信息:在firefox上,鑰匙的發送確實是什麼都沒有只有在chrome上傳開始並完成(有一個% indicatior表明它已完成,但處理文件後的加載屏幕沒有消失,爲了繼續進程)。 對上傳的元素看起來是這樣的:

 <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> 

回答

0

我不能評論:您可以嘗試發送「確認」的按鈕或鼠標DOUBLE_CLICK關鍵。我看到過類似的問題,不得不使用這些解決方法。

+0

嘗試發送Keys.ENTER並嘗試雙擊 – CosminO