My application has the following snippet of code:
<form id="frmDepartmentCreation" name="frmDepartmentCreation" method="post"
action="">
<table class="formStyle_1" border="0" cellpadding="0" cellspacing="10"
width="100%">
<tr>
<td> </td>
<td align="left"><label class="formBtn_1">
<input id="Submit" name="Submit" value="Submit" type="submit"
onclick="return val()"/></label>
<input type="hidden" name="hdnbu开发者_高级运维tton" id="hdnbutton" value=""/>
</td>
</tr>
</table>
</form>
What is the xpath of "Submit" button considering the above code?
You don't need XPath and I wouldn't recommend using xpath in this situation. In this case id can be used as below:
selenium.click("id=Submit");
The above code would do what you want.
//form[@id = 'frmDepartmentCreation']//input[@id = 'Submit']
is one way (starting with //
is done as I assume that snippets is part of a larger document.
精彩评论