簡體   English   中英

無法找到按鈕並使用單擊功能:Java的Selenium WebDriver

[英]Not able to locate the button and use click function: Selenium WebDriver with Java

我無法找到按鈕並在使用Java的Selenium Webdriver自動運行的網站中單擊它。 有人可以幫忙嗎? (使用CSS選擇器)

以下是按鈕的HTML

<div class="inputWrapper newButton" name="uploadDiv">
<h6 name="fileUpload">
<label for="pdfFileUplod">Upload file</label>
</h6>
<input id="pdfFileUplod" class="fileInput hidden_" type="file" onchange="checkFile = checkFileName(this);" name="uploadFile"/>
</div>

如果您認為文件上傳按鈕具有ID,請使用它:

WebElement el = driver.findElement(By.Id("pdfFileUplod"));
el.click()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM