我无法在网站中找到该按钮并单击它,我正在使用带有 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()
关于java - 无法找到按钮并使用点击功能 : Selenium WebDriver with Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39398095/