我正在用Java编写一个使用WebDriver提交表单的程序。有一个findElement方法,允许您使用类名,CSS选择器,ID,链接文本,名称,部分链接文本,标记名称或xpath来选择元素。使用WebDriver(findElement函数)
下面是我想选择按钮:
<div class="editable" style = "width:82px;float:right;margin-right:10px;">
<a href="#" onclick="$('order_form').submit(); return false;" class="btn">
<img class="btn" src="/myhuds/images/rd_images/btn_place_order.gif" alt="Place Order" width="82" height="17" border="0">
</a>
</div>
我不能使用类名,因为有在页面上多个按钮。关于如何使用findElement方法选择此按钮的任何想法?
谢谢!
我现在正在尝试;谢谢! – user1880633
您可以使用src来查找图像。 http://stackoverflow.com/questions/3577134/searching-for-an-image-by-src-in-selenium – Prash