HTML代码:硒的webdriver - 无法按钮点击
<div class="buttonBG">
<input type="button" onclick="window.location.href='?mod=eA&act=00001';" class="buttonGreen" value="TK">
<input type="button" onclick="ttoggle('carianDiv');" class="buttonGreen" value="CK">
</div>
下面是我的Java代码,当我尝试用下面的代码。我能知道什么是错在我的硒的webdriver代码:
driver.findElement(By.xpath("//input[@class='buttonGreen' and contains(@onclick, 'window.location.href='?mod=eA&act=00001')]")).click();
这是缺少HTML代码 -
你有什么错误信息?分享你分享你的错误信息或几行你的HTML? – Aravin
线程“main”中的异常org.openqa.selenium.NoSuchElementException:无法找到元素:{“method”:“css selector”,“selector”:“[value ='TK']”} 命令持续时间或超时: 5.03秒 – Sandeep