我试图上传一个文件,但它引发了异常。上传按钮是定制的。我什至试图点击它,但它卡在那里。
new WebDriverWait(driver,100).until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@id='divProfileSetting']/div/div/div/div[7]/div[2]/div/div/div/label/span")));
WebElement UploadingFile1 = driver.findElement(By.xpath("//div[@id='divProfileSetting']/div/div/div/div[7]/div[2]/div/div/div/label/span"));
//UploadingFile1.click();
UploadingFile1.sendKeys("E:\\Hatha.jpg");
HTML:
<div class="span12 logouploadContainer">
<input type="file" id="file" name="file" tabindex="-1" style="position: fixed; left: -9999px;">
<div class="bootstrap-filestyle" style="display: inline;" tabindex="0">
<input type="text" class="input-large" disabled="">
<label for="file" class="btn btn-primary">
<i class=" icon-white icon-folder-open" data-original-title="" title=""></i>
<span data-original-title="" title="">Choose File</span>
</label>
</div>
<div id="logo-div" class="hidden">
<button type="button" id="btnResetLogo" class="btn" style="margin-left: 5px;" data-original-title="" title="">Remove</button>
<div id="imgContainer" style="height: 100%; width: 100px; padding: 5px; overflow: hidden;">
<img alt="Client Logo" id="imgClient" src="">
</div>
</div>
</div>
也尝试过等待元素,但似乎有一些问题。
繁星coding
哈士奇WWW
相关分类