【发布时间】:2021-03-29 02:02:39
【问题描述】:
我目前正在做一个项目,我可以选择除一个以外的所有元素,它真的很令人沮丧,代码如下
<a class="btn btn-default button button-medium" href="http://automationpractice.com/index.php?controller=order" title="Proceed to checkout" rel="nofollow">
<span>
Proceed to checkout<i class="icon-chevron-right right"></i>
</span>
</a>
我已经尝试过 xpath、css、linktext、title 和其他方法但没有运气,任何帮助都会真正得到帮助
我使用过的 xpath 示例
driver.findElement(By.xpath("/html//div[@id='layer_cart']//a[@title='Proceed to checkout']/span")).click();
我用过的css示例
driver.findElement(By.cssSelector("a[title='Proceed to checkout'] > span")).click();
【问题讨论】:
-
请发布错误堆栈?
-
另一个奇怪的事情没有错误
标签: java selenium xpath css-selectors webdriverwait