简体   繁体   中英

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

I am not able to locate the button and click it in the website i am automating using selenium webdriver with java. Could anyone Help? (using CSS selectors)

Below is the HTML for the button

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

If you think on file upload button, you have id, so use it:

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

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