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