我想上傳一個CSV文件到我的應用程序。無法通過硒文件上傳文件?
我收到以下錯誤:
unknown error: cannot focus element (Session info: chrome=55.0.2883.87) (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.13.0-107-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 101 milliseconds
我的代碼:
UtilsMethods.element = UtilsMethods.driver.findElement(By.xpath(".//*[@id='dragandrophandler']"));
Thread.sleep(10);
UtilsMethods.element.sendKeys("/home/arima/wrangler_testdata/Telstra/test.csv");
的html代碼:
<section class="wrangler-product-upload-connect z-depth-1">
<div class="row" style="margin-top:25px;">
<div class="col l12 m12 s12">
<div class="col l12 m12 s12" style="padding: 0px;">
<div class="upload-connect-content">
<div id="upload" class="col s12" style="display: block;">
<input id="fileupload" style="display:none" type="file"/>
<form class="file-uplaod-form" method="post" action="" enctype="multipart/form-data">
<div class="box-content center-align">
<div id="dragandrophandler" style="height:250px;">
<i class="fa fa-cloud-upload" aria-hidden="true"/>
<br/>
Drag & Drop Files Here
</div>
</div>
</form>
</div>
<div id="test2" class="col s12" style="display: none;">
</div>
</div>
</div>
</section>
顯示一些'HTML'代碼 – Andersson
.csv文件的路徑是否正確? –
是的路徑是正確的。我正在使用Ubuntu。這是否是問題? – Sidhartha