xpath to save html element value to session variable

Hi,

I am executing an http get which returns html including a hidden input element in the following format:

I’d like to save the value 11 into a session variable for use in a subsequent call. I’ve tried:

.check(xpath("""//input[@id=“txtTestID”]@value""").find.saveAs(“testID”))

This doesn’t seem to work, also tried without the @value. Am I doing something wrong, or is there a better way to do this? I’ve read that parsing html with a regular expression is a bad idea,

thanks,

Greg.

Hi,

The XPath library we rely on is currently only working for XML documents.
I would suggest you to use a CSS selector like this :
.css("#txtTestId", “value”)

cheers
Nicolas

Thanks, the css selector worked perfectly.

I’m new to Google groups, should I mark the topic as answered and/or the reply as the best answer? If so, how is this done as it’s not immediately obvious?

Greg.

Glad to hear it’s working.

Well, that’s just a mailing-list, there isn’t any fancy functionalities like on StackOverflow.

cheers
Nicolas