这是我的按钮链接:
<a class="button" href="#" onclick="ajaxtoelement('include/system.php?mode=begin&location='+getSelectedValue('location')+'&terminallane='+getSelectedValue('terminallane')+'','keyboard')</a>"
我试过
driver.findElement(By.xpath("//a[@class='ajaxtoelement('include/system.php?mode=begin&location='+getSelectedValue('location')+'&terminallane='+getSelectedValue('terminallane')]"));
为什么 selenium 仍然找不到我指定的按钮?
最佳答案
它应该通过 onclick
而不是 class
访问,一种简单的方法是,
driver.findElement(By.xpath("//a[contains(@onclick, 'onClickValue')]");
关于java - Selenium webdriver 找不到我的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31739147/