tags:

views:

118

answers:

2
//input[@type="hidden" and @name="val" and position() = 1]/@value

does this mean get the text typed inside the input box ?

+1  A: 

I think it means grab the value attribute of an input whose type attribute is 'hidden' in addition its name attribute is 'val' and its position amongst its siblings is 1 ( first I believe, not sure if 0 is the start in xpath ).

<input type="hidden" name="val" value="test">
<input type="hidden" name="foo">
meder
//input[type="hidden" and name="val" and position()=1]').value = 'blah'would that specify the value as blah ?
asdfasdf
`[@type="hidden" and @name="val" and position() = 1 and @value="blah"]`
meder
+1  A: 

Read from right to left, it means "Get the value attribute of all of the input tags whose type attribute is 'hidden', whose name attribute is 'val', and which appears as the first element in its enclosing (form) tag".

Jonathan Feinberg
how can i specify the value with a text of my own ?
asdfasdf
Use the stuff inside the square brackets as an example of how to specify what you're looking for.Also, see http://www.w3schools.com/XPath/default.asp .
Jonathan Feinberg