gpt4 book ai didi

java - 无法找到按钮并使用点击功能 : Selenium WebDriver with Java

转载 作者:行者123 更新时间:2023-11-28 05:14:07 24 4
gpt4 key购买 nike

我无法在网站中找到该按钮并单击它,我正在使用带有 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com